Re: Running queries one after the other
From: fredg (fgutkind_at_example.invalid)
Date: 06/12/04
- Next message: Dale Fye: "Re: Date Restrictor for last business day"
- Previous message: fredg: "Re: Date Restrictor for last business day"
- In reply to: Noel: "Running queries one after the other"
- Next in thread: Noel: "Re: Running queries one after the other"
- Reply: Noel: "Re: Running queries one after the other"
- Messages sorted by: [ date ] [ thread ]
Date: Sat, 12 Jun 2004 23:17:11 GMT
On Sat, 12 Jun 2004 06:28:13 -0700, Noel wrote:
> Hi. Some time ago I created a command button On Click
> event code as follows to run two Queries, one after the
> other. I retested this recently and I now find that the
> first query runs but the second does not. I must have
> changed something and forgot to retest it at the time.
> Whats gone wrong? Thanks, Noel
>
> The first query is called Append School Offers to Archive
> The second is called Clear Fields - School Offers
>
> Private Sub AppendSchoolOffers_Click()
> On Error GoTo Err_AppendSchoolOffers_Click
> DoCmd.SetWarnings False
> Dim stDocName As String
>
> stDocName = "Append School Offers to Archive"
> DoCmd.OpenQuery stDocName, acNormal, acEdit
> DoCmd.OpenQuery "Clear Fields - School Offers"
> DoCmd.Close
> Exit_AppendSchoolOffers_Click:
> Exit Sub
>
> Err_AppendSchoolOffers_Click:
> MsgBox Err.Description
> Resume Exit_AppendSchoolOffers_Click
>
> DoCmd.SetWarnings True
> End Sub
It's running, but your line DoCmd.Close is closing it as soon as it
opens.
What are you trying to Close? The form that calls the queries?
Use
DoCmd.Close acForm, Me.Name
Also, you have the
DoCmd.SetWarnings True
in the wrong place.
The code will never reach that line as it will either exit after
closing the form, or, if there is an error, resume at the same
Exit_AppendSchoolOffers_Click: line.
Move that line to right after the second OpenQuery line.
-- Fred Please only reply to this newsgroup. I do not reply to personal email.
- Next message: Dale Fye: "Re: Date Restrictor for last business day"
- Previous message: fredg: "Re: Date Restrictor for last business day"
- In reply to: Noel: "Running queries one after the other"
- Next in thread: Noel: "Re: Running queries one after the other"
- Reply: Noel: "Re: Running queries one after the other"
- Messages sorted by: [ date ] [ thread ]