Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DoCmd.OpenModule not working.

Status
Not open for further replies.

aexley

Technical User
Jul 9, 2001
147
GB
I have a function called "Import Site Details" containing two procedures one titled "Import_Site_Details_YES_BUTTON()" and the other, imaginatively, called "Import_Site_Details_NO_BUTTON()".

I am attempting to run one of these proceduresfrom a Private Sub (which one depends on the results from a message box) using:

DoCmd.OpenModule "Import Site Details", "Import_Site Details_NO_BUTTON()" (or _YES_BUTTON())


The problem is I keep getting the error message:

Error Number'2517'
Microsoft Access cannot find the procedure "Import_Site Details_NO_BUTTON()"

"Import Site Details" isn't a private module so what's the problem? I've tried removing the "" around the module name and replacing with [] but I just get:

'Expected variable or preocedure, not module'

And if I do the same with the function name I get:

'Run time Error 2465 Microsoft Access can't find the field 'Forms' referred to in your expression.'

Any help on this would be much appreciated.

Thanks in advance.

aexley

 
Update:

By removing the '()' at the end of the function name I lose the error messages but all I get instead is the VB window opening and the code doesn't appear to be running.

Obviously I'm missing something basic here. Am I using the wrong command?

Thanks in advance

aexley

Quote for the day - "In six months we've advanced about as far as an asthmatic ant with a load of heavy shopping." Captain Blackadder (1917)
 
Call off the wolves.

After a bit of experimenting and a determined hunt through the oh so clear (as mud) Access Help. I found out I didn't need to use the 'DoCmd. etc' at all.

Just reference the procedure in parentheses. Problem solved.

Quote for the day - "Never go a day without learning something useless"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top