Run multiple queries

Mrs.Meeker

Registered User.
Local time
Today, 20:22
Joined
Mar 28, 2003
Messages
172
I have 5 append queries that I want to run from the push of a single command button but I don't know how to string together the code. I was instructed to build a button to run one query and then copy the code down 4 times and rename each one according to the querie names.

Currently the queries feed information into a table but I will eventually be adding another form that I will want to use the same button to open to be used as a questionaire.

Thanks
Rhonda

here's an example, can you tell me how much of the 2nd code to remove to combine it with the first and make it one?

Private Sub CmdNext_Click()
On Error GoTo Err_CmdNext_Click

Dim stDocName As String

stDocName = "qryAbutmentType"
DoCmd.OpenQuery stDocName, acNormal, acEdit

Exit_CmdNext_Click:
Exit Sub

Err_CmdNext_Click:
MsgBox Err.Description
Resume Exit_CmdNext_Click

End Sub

Private Sub CmdNext_Click()
On Error GoTo Err_CmdNext_Click

Dim stDocName As String

stDocName = "qryPierType"
DoCmd.OpenQuery stDocName, acNormal, acEdit

Exit_CmdNext_Click:
Exit Sub

Err_CmdNext_Click:
MsgBox Err.Description
Resume Exit_CmdNext_Click

End Sub
 
Try this:

Private Sub CmdNext_Click()
On Error GoTo Err_CmdNext_Click

DoCmd. SetWarnings(0)
DoCmd.OpenQuery ("YourQueryName1")
DoCmd.OpenQuery ("YourQueryName2")
DoCmd.OpenQuery ("YourQueryName3")
DoCmd.OpenQuery ("YourQueryName4")
DoCmd.OpenQuery ("YourQueryName5")

Exit_CmdNext_Click:
Exit Sub

Err_CmdNext_Click:
MsgBox Err.Description
Resume Exit_CmdNext_Click

End Sub


I've also turned off the prompts access gives you when about to run an action query
 
Thanks! I've stumbled upon another little problem and when I get it fixed I'll let you know how this works!

thanks again!
Rhonda
 
This didn't work as expected. It's running the queries but my table is filling up with duplicates. I'm going to start another thread about it, I don't think it would get answered here.
 
NOOOOO!!!!

I've seen second questions asked before and get ignored. So I thought I was supposed to start a new thread cuz it's kind of another topic.

Hope you aren't mad!!
 
Mrs.Meeker said:
NOOOOO!!!!

I've seen second questions asked before and get ignored. So I thought I was supposed to start a new thread cuz it's kind of another topic.

Hope you aren't mad!!

I was teasing you :)

When you see a :D - it usually means the comment should be taken in humour. Well in my case anyway. You post away
 

Users who are viewing this thread

Back
Top Bottom