By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,652 Members | 1,911 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,652 IT Pros & Developers. It's quick & easy.

ADO Execute or command execute?

P: n/a
Hi there

The below code executes some queries.
As newbie I was wondering weather you are better of using connection execute
or command execute to execute queries?

I am asking as Gcnndoh.Execute "AppendDataEntrySummaryLevel2" causes a
Run-time error '-2147217900 (80040e14).
If I execute the query from the query editor it's working ok!! No
messages!!!
"*****code snipple********
Set Gcnndoh = CurrentProject.Connection
'append missing data entered "=Querynames"
Gcnndoh.Execute "CreateTempdatacheck"
Gcnndoh.Execute "AppendDataEntrySummaryLevel1"
Gcnndoh.Execute "AppendDataEntrySummaryLevel2"
DoEvents

Gcnndoh.Close
set Gcnndoh = nothing

any suggestions are much appreciated.

Norman


Nov 12 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
While I don't immediately recognize this error number, I'm going to guess
that your query has some references which can be resolved in the Query
Editor, but not by ADO. For example, if you reference a control on a form
directly in the query, ADO won't be able to resolve that reference.
It won't make a bit of difference whether you use connection or command
execute.

If you'd like to post the SQL of "AppendDataEntrySummaryLevel2", perhaps we
can make further suggestions.

BTW, are you working in an ADP, or an MDB? Is your back end data in Access?

HTH
- Turtle

"Norman Fritag" <mu*****@ozemail.com.au> wrote in message
news:gq*****************@nnrp1.ozemail.com.au...
Hi there

The below code executes some queries.
As newbie I was wondering weather you are better of using connection execute or command execute to execute queries?

I am asking as Gcnndoh.Execute "AppendDataEntrySummaryLevel2" causes a
Run-time error '-2147217900 (80040e14).
If I execute the query from the query editor it's working ok!! No
messages!!!
"*****code snipple********
Set Gcnndoh = CurrentProject.Connection
'append missing data entered "=Querynames"
Gcnndoh.Execute "CreateTempdatacheck"
Gcnndoh.Execute "AppendDataEntrySummaryLevel1"
Gcnndoh.Execute "AppendDataEntrySummaryLevel2"
DoEvents

Gcnndoh.Close
set Gcnndoh = nothing

any suggestions are much appreciated.

Norman

Nov 12 '05 #2

P: n/a
Turtle,
thanks for your reply!
I am working in Mdb, the backend data is in access.
Here is the error message and the sql of "AppendDataEntrySummaryLevel2:
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 when call by ado:
'**********************************
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];

I hope that asists.

regards Norman

"MacDermott" <ma********@nospam.com> wrote in message
news:Z7***************@newsread3.news.atl.earthlin k.net...
While I don't immediately recognize this error number, I'm going to guess
that your query has some references which can be resolved in the Query
Editor, but not by ADO. For example, if you reference a control on a form
directly in the query, ADO won't be able to resolve that reference.
It won't make a bit of difference whether you use connection or command
execute.

If you'd like to post the SQL of "AppendDataEntrySummaryLevel2", perhaps we can make further suggestions.

BTW, are you working in an ADP, or an MDB? Is your back end data in Access?
HTH
- Turtle

"Norman Fritag" <mu*****@ozemail.com.au> wrote in message
news:gq*****************@nnrp1.ozemail.com.au...
Hi there

The below code executes some queries.
As newbie I was wondering weather you are better of using connection

execute
or command execute to execute queries?

I am asking as Gcnndoh.Execute "AppendDataEntrySummaryLevel2" causes a
Run-time error '-2147217900 (80040e14).
If I execute the query from the query editor it's working ok!! No
messages!!!
"*****code snipple********
Set Gcnndoh = CurrentProject.Connection
'append missing data entered "=Querynames"
Gcnndoh.Execute "CreateTempdatacheck"
Gcnndoh.Execute "AppendDataEntrySummaryLevel1"
Gcnndoh.Execute "AppendDataEntrySummaryLevel2"
DoEvents

Gcnndoh.Close
set Gcnndoh = nothing

any suggestions are much appreciated.

Norman


Nov 12 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.