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!

Assign macro (module) to button in MS Access

Status
Not open for further replies.

phudgens

Technical User
Jul 8, 2004
117
US
In MS Excel 2007 I can place a button on a worksheet and then assign a macro or module to that button. I'd like to do the same thing in MS Access 2007, placing a button either in the main window area or on the toolbar, but I'm not seeing a way to do that. Can anyone provide some insight?

Thanks very much,
Paul Hudgens
Denver
 
Once again, Billy Gates has blown my mind. The designers of Access apparently don't think that there needs to be a way to quickly access modules or sub-routines. So I add a form, add a button to that form, try and assign a module, no can do, but it gives me it's own sub-routine, so I add a call to the sub I want to run, but then it can't find that sub, even though it definitely is present in the db. I give up. Thanks for the help anyway.
 
Mr. Gates has designed a command button wizard that when you drop a command button on a form, it will step you through the a large number of options. It can write the code for you or you can open the properties for the command button and click the builder button [...] to the right of the Click event.

I'm not sure it could be much easier.

Duane
Hook'D on Access
MS Access MVP
 
Why do you feel compelled to rub it in my face? It's easy, precious, if you know how to do it. I clicked on the "builder button" and was given 3 options, macro builder, expression builder, and code builder, none of which allowed me to assign a macro, or anything else, to the button. One of the simpler things in the world to do should be to add a button to an access toolbar and assign a macro, or a module, or sub-routine to it. I've been working in Access a total of about 3 months now - how long have you been working in it? I just wrote my first program 2 days ago! But you have to rub it in my face!
 
Sorry if you are offended but your tone got sarcastic with "Once again, Billy Gates has blown my mind."

If you have an existing macro you wish to assign to a command button, the On Click event property is a drop-down of all existing macros. If you don't have an existing macro or want to use code/VBA then select Code Builder and a window opens with the first and last lines of code ready for you to enter whatever you want between.

When you add a new command button with the wizard turned on, you will be offered the opportunity to select from categories and actions which include Miscellaneous->Run Macro.

If you are interested in modifying the ribbon, then I believe most Office applications are similar. You might want to look at Access - Ribbons.


I guess I never use macros.

Duane
Hook'D on Access
MS Access MVP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top