View Full Version : Execute Two Statments In Query


crhodus
03-11-2008, 05:47 AM
Is there a way to execute two statements in one query in access? I tried the following but received the following: "Characters found at the end of the SQL statment".

Here is what I have in my qryUpdateRecords file:

"UPDATE dbo_CE, tblCE_Details SET tblCE_Details.LIC_NUMBER = [dbo_CE].[LICENSE_NUM], tblCE_Details.Credit_Hours = [dbo_CE].[CREDIT_HOURS], tblCE_Details.Course_Sponsor = [dbo_CE].[COURSE_SPONSOR], tblCE_Details.Course_Name = [dbo_CE].[COURSE_NAME], tblCE_Details.Auth_Code = [dbo_CE].[AUTH_CODE], tblCE_Details.Category = [dbo_CE].[CATEGORY], tblCE_Details.Course_Date = [dbo_CE].[COURSE_DATE], tblCE_Details.ImportDate = Now() WHERE ([dbo_CE].EXPORT_TIMESTAMP IS NULL ) ; UPDATE dbo_CE SET([dbo_CE].EXPORT_TIMESTAMP = NOW() WHERE ([dbo_CE].EXPORT_TIMESTAMP IS NULL);"


Thanks,
CRhodus

DCrake
03-11-2008, 06:01 AM
Why are you trying to run two queries at once?

Why not simply run them one after the other?

namliam
03-11-2008, 08:29 AM
Yep, make two seperate queries and use either a macro or vb code to run them as "one"

The_Doc_Man
03-11-2008, 08:31 AM
Observations from first glance:

1. The first part of your query updates two tables but you have no join syntax. Beware of implicit permutation joins.

2. The second query would update a field that is in one of the tables named in the first part of the query AND appears to use the same WHERE criteria. If you get the first update to work, include that second update in list of fields to update for the first query.