467,225 Members | 1,397 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,225 developers. It's quick & easy.

Run Macro selected from a listbox off another form.

I have a report sceniro where I have the user select a Report(acutally it is a macro but didn't want to confuse the user) off of Form1. When the user double clicks the Macro name it opens Form 2 which allows the user to put in critera. I want to be able to click a button on Form 2 that will run the Macro after the criteria has been entered. What would be recommended? Thank You.
Sep 27 '07 #1
  • viewed: 2150
Share:
1 Reply
Scott Price
Expert 1GB
I have a report sceniro where I have the user select a Report(acutally it is a macro but didn't want to confuse the user) off of Form1. When the user double clicks the Macro name it opens Form 2 which allows the user to put in critera. I want to be able to click a button on Form 2 that will run the Macro after the criteria has been entered. What would be recommended? Thank You.
You can place the DoCmd.RunMacro command in the OnClick event of your command button:

This example is straight from VBA help files:
Expand|Select|Wrap|Line Numbers
  1. DoCmd.RunMacro "Print Sales", 2
This will cause the macro to run twice (the 2 value tells it how many times to run) thus printing two copies of the Sales report.

Regards,
Scott
Sep 28 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

7 posts views Thread by ChrisR | last post: by
2 posts views Thread by John | last post: by
4 posts views Thread by rn5a@rediffmail.com | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.