+ Reply to Thread
Results 1 to 4 of 4

Thread: calling function

  1. #1
    Barn Enthusiast guddu is on a distinguished road guddu's Avatar
    Join Date
    Jul 2008
    Location
    Oxford UK
    Posts
    469
    Rep Power
    4

    calling function

    hi
    i have one function which send message named sendmessage.this function returns false if sending failed.now i want to give 3 tries to this function in case of failure.i meant this function will be called maximum three time in case of failure.and in all 3 attempts message being not send then i want to call a error routine.how to do this.

    Code:
     bReturn = SendMessage(BatchGuid, "Admin", "TR",Senderid, 1, asLines(i), Null)
          If Not bReturn Then
            'raise an error
            mClientErrorAdd asLines(i), _
                              ERR_NO_GHS_MESSAGE_SEND
          End If
    
    hope it make some sense.
    Last edited by guddu; November 4th, 2008 at 03:03 PM.
    Love is physical attraction and mental destruction

  2. #2
    The Barnfather jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead's Avatar
    Join Date
    Mar 2008
    Location
    Reston, VA
    Posts
    4,533
    Blog Entries
    9
    Real Name
    Jason
    Rep Power
    22

    You can wrap it in a For...Next statement, checking the condition each time.

    For example:
    Code:
    For i = 1 To 3
        bReturn = SendMessage(BatchGuid, "Admin", "TR",Senderid, 1, asLines(i), Null)
        If bReturn Then
            ' Message was sent, exit loop
            Exit For
        Else
            ' There was an error, if 3rd attempt, call error message routine
            If i = 3 Then
                ERR_NO_GHS_MESSAGE_SEND
            End If
        End If
    Next
    
    jmurrayhead
    If you agree, give me rep.
    If you like it here...throw us a few bones to help support us.


  3. #3
    Barn Enthusiast guddu is on a distinguished road guddu's Avatar
    Join Date
    Jul 2008
    Location
    Oxford UK
    Posts
    469
    Rep Power
    4

    JMH thanks a lot.did the trick.
    Love is physical attraction and mental destruction

  4. #4
    The Barnfather jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead's Avatar
    Join Date
    Mar 2008
    Location
    Reston, VA
    Posts
    4,533
    Blog Entries
    9
    Real Name
    Jason
    Rep Power
    22

    Quote Originally Posted by guddu View Post
    JMH thanks a lot.did the trick.
    Cheers, Guddu...glad I could help
    jmurrayhead
    If you agree, give me rep.
    If you like it here...throw us a few bones to help support us.


+ Reply to Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

SEO by vBSEO