Macro can't find function

D

dbqstamp

I am using ther RunCode option in a macro to execute a function. The function
exists in a module in the same database as the macro. There are paranthesees
following the function. When I try tp run the macro the message "The
expression you entered has a function name that Microsoft Office Access can't
find" appears. In the Function Name area of the macro I used the ... to find
the function when I created the macro. Why can't the macro find the function
when it runs??
 
M

Marshall Barton

dbqstamp said:
I am using ther RunCode option in a macro to execute a function. The function
exists in a module in the same database as the macro. There are paranthesees
following the function. When I try tp run the macro the message "The
expression you entered has a function name that Microsoft Office Access can't
find" appears. In the Function Name area of the macro I used the ... to find
the function when I created the macro. Why can't the macro find the function
when it runs??


Make sure the function is declared Public.
 
R

Robert Morley

Also make sure that the Function is actually a Function and not a
Sub...IIRC, RunCode will only work on Functions.



Rob
 
D

dbqstamp

If you mean Public as in "Public Function NameOFFunction()" it is that way.
Thanks.
 
D

dbqstamp

It is a Function. Thanks.

Robert Morley said:
Also make sure that the Function is actually a Function and not a
Sub...IIRC, RunCode will only work on Functions.



Rob
 
M

Marshall Barton

The only other thing I can think of is if the function is in
a class (or form/report) module instead of a stanfard
module. However, the expression builder should not provide
that option so I have no real answer for you.

Because I found the builder confusing, the few times I have
done this kind of thing, I just type the function instead of
using the builder.
 
R

Robert Morley

Two more thoughts on this:

First, is there a chance that you've got identical function names or you're
using a reserved word for the function? Perhaps RunCode is having
difficulty properly resolving it. Try changing it to something totally
guaranteed to be unique and not reserved like "zxqw", or something of that
nature.

Second, if the above has no effect, what happens if you cut & paste the code
to a new module? (Note: Cut & Paste only, do NOT Export & Import.)


Rob
 

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