Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2003

    Red face Unanswered: Empty Optional Arguments

    I'm passing arguments from a form to a function, but fully expect that not all the arguments will be filled all the time--thus they are all declared as Optional in the function. Such as:

    Function Test(Optional Arg1, Optional Arg2, Optional Arg3, Optional Arg4)

    When called, it is possible for not all of the arguments to be passed:

    a = Test("AA","BB",,"DD")

    I then use these arguments to populate a table record like so:

    With rcd
    !FLD3=Arg3 (expecting it to be Null)
    End With

    The problem is that if one of the arguments was left blank, I hit a runtime error when the code gets to the point of adding the new record, i.e. when it gets to FLD3 above. How can I easily pass over optional arguments that were intentionally left empty?

  2. #2
    Join Date
    Dec 2002
    Préverenges, Switzerland
    does your table accept Null?

    can you use a construct something like
    if not isnull(Arg3) then !FLD3=Arg3

    currently using SS 2008R2

  3. #3
    Join Date
    Oct 2003
    Provided Answers: 1
    Try to use the IsMissing() function

    If IsMissing (Arg3) then Arg3=""

Posting Permissions

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