By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,141 Members | 1,225 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,141 IT Pros & Developers. It's quick & easy.

Calling Command Button On Click Event from a Custom Toolbar

P: n/a
Is it possible to call the on click event procedure for a command
button on a custom toolbar? I have a menu of buttons that open various
forms in varying ways that are all controlled in the on click event. I
would like to be able to reference these events in a custom toolbar
instead of creating macros. If I can create code to open a form in VBA
why can't I use that code to open the form from the toolbar? Can
someone explain to me how this is done? I'm not sure what the correct
syntax would be to accomplish this. Thanks in advance.

Jul 10 '07 #1
Share this Question
Share on Google+
1 Reply


P: n/a
If you want to execute code with a menu button, you need to put the code
inside a function either behind the form or in a module. Code to open a form
would look like:
MyFunction()
DoCmd.OpenForm "MyForm"
End Function

Then in the Action property of the button, you would put:
=MyFunction()

PC Datasheet
Providing Customers A Resource For Help With Access, Excel And Word
Applications
re******@pcdatasheet.com


"adrianm4380" <ad**********@healthnetworklabs.comwrote in message
news:11**********************@d55g2000hsg.googlegr oups.com...
Is it possible to call the on click event procedure for a command
button on a custom toolbar? I have a menu of buttons that open various
forms in varying ways that are all controlled in the on click event. I
would like to be able to reference these events in a custom toolbar
instead of creating macros. If I can create code to open a form in VBA
why can't I use that code to open the form from the toolbar? Can
someone explain to me how this is done? I'm not sure what the correct
syntax would be to accomplish this. Thanks in advance.

Jul 10 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.