Thread: Running VBA Functions
07-24-07, 12:58 #1Registered User
- 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:
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>>]
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
07-24-07, 15:05 #2Moderator
- 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)