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!

How to Create a Macro

Status
Not open for further replies.

krishreddy

Technical User
Jul 20, 2006
2
US
hi guys,
I have three queries. They are TrafficAccident_Append,NameInformation_Append and Delete query.

These queries need to be executed in the following order.

1)TrafficAccident_Append,
2)NameInformation_Append

When the above queries are executed, the information is appended to the corresponding tables. Then
Delete query needs to be executed.

All these 3 queries need to be executed by just one click on the macro created for them.

So cud anyone tell me in step wise how to create a macro in order to execute these 3 queries one by one.

waiting for reply.

 
no one 'really' uses macros. the reasons are easily found searching here, there or most anywhere.

your 'soloution' needs to utilize a 'transaction', which again, can be found ...



MichaelRed


 
1 create new macro - in design view

2 in actions colomn combobox select 'openquery'
In the 'query name' combobox at the bottom of the window select the name of query you wish to run.

3 go down to the next row in the action colomn list and do the above (2) for all the queries you wish to run

4 save macro

5 name macro

6 create a control on a form to run the macro using the controls 'on click' event (or use the wizard)


Ian Mayor (UK)
Program Error
Programming is 1% coding, 50% error checking and 49% sweat as your application bombs out in front of the client.
 
Or, as MichaelRed indicated, run the queries from your button click event...

Code:
Private Sub cmdButton_Click()
   DoCmd.SetWarnings False
   DoCmd.OpenQuery "TrafficAccident_Append"
   DoCmd.OpenQuery "NameInformation_Append"
   DoCmd.OpenQuery "YourDeleteQuery"
   DoCmd.SetWarnings True
End Sub



Randy
 
randy700 ... That is NOT a transaction. Please refer to the handy and ubiquitous {F1} (a.k.a. Help).




MichaelRed


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top