Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2007

    Unanswered: Running VBA Functions

    I created a number of functions that Insert and update my data. seperately, they work; however, when I try to bring them together using a macro, I get "the expression you entered has a function name that Microsoft Office Access can't find"

    My function is the following:
    Function UpdateFixAction()
    On Error GoTo UpdateFixAction_Err

    DoCmd.RunSQL "Update FIX_FILES INNER JOIN FileNameFix On FIX_FILES.[<<Field>>]=FileNameFix.[<<Field>>]
    SET FIX_FILES.[<<Field>>] = FileNameFix.[<<Field>>]
    WHERE FIX_FILES.[<<Field>>]=FileNameFix.[<<Field>>];"

    Exit Function
    MsgBox Error$
    Resume UpdateFixAction_Exit
    End Function
    Like I said, as a stand alone, it worked; when I tried to have a macro call the function i got the error.

    I new to VBA/Coding, I want to know how to get a Function or Sub to call a Function or sub and a macro to call all Subs and Function.

    Your help will be greatly appreciated
    Thanks in advance

  2. #2
    Join Date
    Dec 2004
    Madison, WI
    You don't need macros. In your subs just enter a: call MyFunctionName(). If you're calling a function in another form verses a module, you may need to change it from Function XXX() to Public Function XXX() or Private sub XXX() to Public sub XXX().
    Last edited by pkstormy; 07-24-07 at 15:08.
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

Posting Permissions

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