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

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » How does a macro receive a function argument? (97)

    Author
    Topic
    #373737

    How does a macro receive a function argument?
    I

    Viewing 0 reply threads
    Author
    Replies
    • #601730

      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”)

      • #601732

        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.

        • #601734

          (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.

          • #601736

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

            • #601741

              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.

    Viewing 0 reply threads
    Reply To: How does a macro receive a function argument? (97)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: