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

Running Access Macros when closing a Form

Status
Not open for further replies.

JP2275

Technical User
Sep 23, 2005
4
US
I am having trouble applying two macros to run when closing out a form in Access; each macro runs a separate Update Query. I have tried fixing this two different ways, but can't seem to get it to work either way.

#1 - I go into the OnClose property of the Form, and enter a macro to run, and it will work ok. But I can't figure out how to enter two macros in the OnClose property to run one after the other.

#2 - I tried combining the two macros into one, but was unsuccessful at that also. It will only run the first one listed. My macro has the MacroName, then a condition of MsgBox("Confirm changes?",1)=1 to ask the user to confirm changes before closing the form and running the update query, and finally the action is OpenQuery with the Update Query listed below. When I list both OpenQueries in the same macro, it only runs the first one.

Someone please tell me where I am messing up! Thanks!



 
You have to put three dots in the Condition under the MsgBox() part, so it knows to 'continue'

You might have to change it to:

Msgbox ("Confirm Changes"),1) - 0 StopMacro

then leave condition under that blank

so it doesn't ask twice

Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244. Basics at
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top