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 Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I have a form say "form1" with 2 co 1

Status
Not open for further replies.

desikan

Technical User
Feb 2, 2001
105
AE
I have a form say "form1" with 2 command buttons running macro1 and macro2 with each macro running various append/delete queries.

I want to keep only 1 command button which on clicking should generate either a "Option1" or "Option2" message box so that user can select either of these options which will run macro1 and macro2 respectively.

I do not know the syntax for such an expression.

Grateful for any help.
 
The best way to do this would be to have the following code in the onclick event of the command button.

dim sMsgReturn

smsgreturn = msgbox("Click yes to run macro1, click no to run macro2", vbyesno,"Select macro to run")

if smsgreturn = vbyes then
docmd.runmacro "macro1"
else
docmd.runmacro "macro2"
end if
 
Your code was perfect and met my requirement beautifully.

Thanks a lot for the trouble you took to write the code and help me.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top