Runing action queries through VBA

Nevy

Registered User.
Local time
Today, 09:29
Joined
May 31, 2005
Messages
31
Hi, I want to run two queries, one to delete, the other to apprend.

If I call them qryAppendX and qyrDeleteX.

How can I run them using the code?

Can I simply write:

Code:
DoCmd.OpenQuery "qyrDeleteX"
...
DoCmd.OpenQuery "qryAppendX"
...


Thanks
 
Dim qry As DAO.QueryDef
Set qry = CurrentDb.QueryDefs("Query Name Here")
qry.Execute
----------------------------
You can also do it using sql:
CurrentDb.Execute "INSERT * INTO [TABLE NAME] FROM [OTHER TABLE]"
-or-
DoCmd.RunSQL "INSERT * INTO [TABLE NAME] FROM [OTHER TABLE]"

but I think .Execute runs the quickest
 
Last edited:

Users who are viewing this thread

Back
Top Bottom