Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2002
    Posts
    59

    Unanswered: calling a function

    I have this Function

    Function adhHandleQuotes(ByVal varValue As Variant, ByVal strDelimiter As String) As Variant

    adhHandleQuotes = adhReplace(varValue, strDelimiter, strDelimiter & strDelimiter)
    End Function

    On Open I have the following in an Event procedure

    Call adhHandleQuotes(Me)

    I get Argument Not optional prompt.

    Suggestions most welcome. Thanks

  2. #2
    Join Date
    Aug 2002
    Location
    Québec, Canada
    Posts
    109
    You have forget the second parameters, it is not a optional parameter

    Code:
    Function adhHandleQuotes(ByVal varValue As Variant, ByVal strDelimiter As String) As Variant
      adhHandleQuotes = adhReplace(varValue, strDelimiter, strDelimiter & strDelimiter)
    End Function
    Replace
    Code:
    Call adhHandleQuotes(Me)
    By
    Code:
    Call adhHadleQuotes(Me,strDelimiter)
    JefB - hope it helps

  3. #3
    Join Date
    Feb 2002
    Posts
    2,232
    You might be a little confused between sub and function. You can use call for both - but for function it makes no sense because you are returning a value (by using call - you are discarding the return value, so use a sub).

    So you might have the following:

    strReturn = adHandleQuotes... in your main code.

    If you are not returning a true value and just modifying the value using byVal then use sub - not function.

    FYI - The call statement only exists to support (much) older versions.

Posting Permissions

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