Results 1 to 6 of 6
  1. #1
    4 Star Lounger
    Join Date
    Jun 2001
    Posts
    531
    Thanks
    0
    Thanked 0 Times in 0 Posts

    How does a macro receive a function argument? (97)

    How does a macro receive a function argument?
    I

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: How does a macro receive a function argument? (97)

    If you select RunCode as action, the first row in Action arguments will be labeled Function name (it might be slightly different in English).
    Enter the function just as you would in code, or in an expression (but without = in front of the function name). For instance if you want to execute the function MyFunc with string argument "Jones":

    MyFunc("Jones")

  3. #3
    4 Star Lounger
    Join Date
    Jun 2001
    Posts
    531
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: How does a macro receive a function argument? (97)

    Yes, I understand your point, but what if the argument is not the same every time the function is called? This is what I want to do. If I specify the VALUE of the argument in the macro what good is that to me when that single value could be one of several? Hope you see my point.

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: How does a macro receive a function argument? (97)

    (1) you can replace the literal string "Jones" by a reference to a control on a form, or by an expression:

    MyFunc(Forms!frmMyForm!txtLastName)

    (2) If you want to do more complicated things, convert the macro to VBA. In VBA, you can refer to variables and constants.

  5. #5
    4 Star Lounger
    Join Date
    Jun 2001
    Posts
    531
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: How does a macro receive a function argument? (97)

    Well point 2 is what I want & I guess what you

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: How does a macro receive a function argument? (97)

    You're right. VBA is much more flexible than macros.

    If you have a macro already, you can convert it:

    Select the macro in the database window.
    Select Save As/Export... from the File menu.
    Select the option to convert to Visual Basic.
    You can include error handling and a description as options.

Posting Permissions

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