Running Macros from Buttons

  • Thread starter Thread starter Pap
  • Start date Start date
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
 
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
 
Back
Top