Running Macros from Buttons

P

Pap

Can you, upon pressing a button within a form, run a
macro dependant upon another populated field within that
form (i.e. "if this field is x then run this macro
otherwise run this other macro").

Ta,

Paul
 
A

Arvin Meyer

This points out where code is easier to use than a macro. In this case you
could use both. In the Click event of your button choose [Event Procedure]
then do something like this (using the ellipses button to get to the code
window):

Private Sub MyButton_Click()
If Me.txt1 >= x Then
DoCmd.RunMacro "MacroName"
Else
DoCmd.RunMacro "MacroName2"
End If
End Sub

--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:
http://www.datastrat.com
http://www.mvps.org/access
 

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

Top