How to Create an Embedded Macro Function?

NoSmoke

Registered User.
Local time
Today, 02:47
Joined
Nov 10, 2012
Messages
99
I have an embedded macro (in a form) that duplicates/appends the current record displayed by the form and I would like to add a bit of VBA code to the macro (to increment a text box value on the appended form). As I understand it, this can be done by the RunCode macro command in which a Function Name is specified. I know how to create a function in VBA (and code it to do what I want) but I cannot figure out how to associate it with the Function Name in the macro. If I create a function within the VBE (with the same name as in the macro), when the macro is executed I get the following error message: "The object doesn't contain the Automation object 'xxx'" where xxx is the name of the function. Can anyone please help with this?

I have BTW a copy of Access 2010 Inside Out which mentions one can, in a macro, "Execute other macros or execute Visual Basic functions" but it is mute as far as I can tell on how to create the function.
 
Do not name the Function the same as the Macro, that only serves to confuse Access. Once you change the name see if that helps. If not please provide the steps you are using in your Macro...
 

Users who are viewing this thread

Back
Top Bottom