Macro question

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
 
T

tina

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
 
B

Bill

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
 
T

tina

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
 
J

Jedi022694

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

Jedi022694

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top