How to make Macro RunCode ? Doesn't see my Function???

M

MyEmailList

I've got some simple code for a form...

Option Compare Database

Public Function TestCode()
MsgBox "Function Worked"
End Function

I understand that the "Run" and "Debug/Step Into" doesn't work for
code in Access... you must execute the code from an object or Macro...
so I am trying to create a macro...
From the "Design Window" I click on Macros and then New

For "Action" I select "Run Code"

Then I click in the "Function" field at the bottom and open the
"Expression Builder"

I see two folders... Built-In-Functions and MyDb Functions

I look in the MyDb Functions folder for the function I created... AND
there is nothing there!!!

I'm sure I'm missing some simple step... thanks for any help.

Mel
 
T

tina

comments inline.

I've got some simple code for a form...

Option Compare Database

Public Function TestCode()
MsgBox "Function Worked"
End Function

I understand that the "Run" and "Debug/Step Into" doesn't work for
code in Access... you must execute the code from an object or Macro...

as a blanket statement, that's not correct. depends on what kind of
procedure it is, and perhaps what kind of module it's stored in.
so I am trying to create a macro...


For "Action" I select "Run Code"

Then I click in the "Function" field at the bottom and open the
"Expression Builder"

don't bother with the expression builder. just type in the name of your
function, *without* an Equal sign (=), and including the parentheses at the
end, as

MyFunctionName()
I see two folders... Built-In-Functions and MyDb Functions

I look in the MyDb Functions folder for the function I created... AND
there is nothing there!!!

I'm sure I'm missing some simple step... thanks for any help.

AFAIK, the public function must be stored in a standard module (not in a
form or report module).

hth
 

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