What's wrong with this query??

M

muenchr

Hi there

For the last 3 month I am executing the below queries via
code behind the form.
Now the query AppendDataEntrySummaryLevel2 is not
working.??? Thare are no wrights restrictions or any
changes made.
I am getting the following error message:
Run-time error '-2147217900 (80040e14)':
Invalid SQL statement;
expected 'DELETE', 'INSERT', 'PROCEDURE','SELECT',
or 'UPDATE'.

Below is the sqlstatement, which causes this error:
'**********************************
INSERT INTO TblEntrySummaryLevel2 ( Dohid, [School Name],
SumOfTotNumberStudentsIMMUNISED, [Date Entered], Ok, [Area
Health Service] )
SELECT TblSCHOOLS.DOHID, TblSCHOOLS.[School Name], Sum
(TblDataEntryStep2.TotNumberStudentsIMMUNISED) AS
TotNumberStudentsIMMUNISED, TblDataEntryStep2.[Date
Entered], 0 AS OK, TblSCHOOLS.[Area Health Service]
FROM TblSCHOOLS INNER JOIN TblDataEntryStep2 ON
TblSCHOOLS.DOHID = TblDataEntryStep2.DOHID
GROUP BY TblSCHOOLS.DOHID, TblSCHOOLS.[School Name],
TblDataEntryStep2.[Date Entered], 0, TblSCHOOLS.[Area
Health Service];

If I execute the query from the query editor it's working
ok!! No messages!!!

Is there any thing wrong with the syntax???

any iders are much appreciated.

Norman

Ps: below is the code used to execute the query.

Set Gcnndoh = CurrentProject.Connection
'append missing data entered
Gcnndoh.Execute "CreateTempdatacheck"
Gcnndoh.Execute "AppendDataEntrySummaryLevel1"
Gcnndoh.Execute "AppendDataEntrySummaryLevel2"
DoEvents

Gcnndoh.Close
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top