RunCode Error in module

G

Guest

I'm using Access 2002. I converted a macro to a module because I need each
step to execute separately - and then I added a RunCode macro to execute the
module. The problem I'm having is when I execute the macro (with a command
button on a form) I get the error "The object doesn't contain the Automation
Object 'Converted'."

How can I fix this? I can't locate any information on this error. Here's how
the function looks:

Weekly_Status_Report_Weekly0_Exit:
Exit Function

Weekly_Status_Report_Weekly0_Err:
MsgBox Error$
Resume Weekly_Status_Report_Weekly0_Exit

End Function


'------------------------------------------------------------
' Weekly_Status_Report_Weekly1
'
'------------------------------------------------------------
Function Weekly_Status_Report_Weekly1()
On Error GoTo Weekly_Status_Report_Weekly1_Err

DoCmd.OpenQuery "03A All Mappable Fields-Step 1a", acViewNormal, acEdit


Weekly_Status_Report_Weekly1_Exit:
Exit Function

Weekly_Status_Report_Weekly1_Err:
MsgBox Error$
Resume Weekly_Status_Report_Weekly1_Exit

End Function

In the macro, I'm only referencing "Converted Macro- Weekly Status Report"
in the function name - do I need to add a function argument somewhere?
Thanks in advance for your help. Please be very specific because I'm not
really very good at this.
 
S

Steve Schapel

Vicki,

Since this was a very simple macro, with only one action, and now
converted to a very simple VBA function, I don't understand "I need each
step to execute separately". Would be simpler just to use the macro.

Anyway, that aside, the Function Name for the RunCode action needs to be
like this...
Weekly_Status_Report_Weekly1()

However, if you are going to use VBA, you might as well just write the
VBA code directly as an event procedure... making a procedure into a
function and then running the function with a RunCode macro is quite
circuitous.
 
G

Guest

You're right. I'd read somewhere in here that a macro executes all of the
steps at the same time (which I later found where it wasn't true). So I'm
back using the macro and it's working just the way it should. Thanks for
your time.
 

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

Similar Threads


Top