Macro question

  • Thread starter Thread starter Bill
  • Start date Start date
B

Bill

Stemming from deep within the "Startup" thread from earlier
today comes a related question about macros.

In the AutoExec macro, I specified "RunCode" and in the
function name pane at the bottom of the macro creation/edit
screen I coded ScrRes as the function name. Then, in a
general module I coded:

Public Function ScrRes()
'code to run in the general module here
End Function

Access reports that it can't find ScrRes.

What did I miss?

Bill
 
see the following, from the RunCode Action topic in Access Help:
You must include parentheses, even if the Function procedure doesn't have
any arguments, as in the following example:

TestFunction()
Unlike user-defined function names used for event property settings, the
function name in the Function Name argument doesn't begin with an equal sign
(=).

did you follow both of the above instructions in your macro?

hth
 
Thanks Tina.
My problem was the missing () after the function name. When I looked
for HELP on the RunCode Action I was unwittingly in HELP for VBA,
which doesn't list help for the RunAction. Anyway, the missing parentheses
in the macro proved to be the only problem.
Bill
 
oh good, glad that fixed it! :)


Bill said:
Thanks Tina.
My problem was the missing () after the function name. When I looked
for HELP on the RunCode Action I was unwittingly in HELP for VBA,
which doesn't list help for the RunAction. Anyway, the missing parentheses
in the macro proved to be the only problem.
Bill
 
Tina,
I followed your suggestion but it did not solve the problem bill described.
I still get the following error: The expression you entered has a function
name that db1 can't find. In my Macro, I have a line "RunCode" that calls a
Function I created as a public function in "Modules". What am I missing?

Thanks.
 
Tina,
Please ignore my previous note, I found out my problem: I used the same name
for both my Module and Function...
Thanks for your feedback.
 
Back
Top