Recordset based on Query

G

Guest

I am trying to create a recordset based on a query. Each time i run code, I
get the following error:
-2147217900:Invalid SQL statement,expected
'DELETE','INSERT','PROCEDURE','SELECT',or 'UPDATE'.

Here is the statement... rst.Open "qryCalculateAmpHrs",
CurrentProject.Connection, adOpenDynamic, adLockOptimistic, accmdtexT
How do I resolve this?
 
G

Guest

Try getting rid of the last parameter and just let it default. I think that
accmdtexT indicates that it expects SQL text as opoposed to a stored query.
Either that or else qryCalculateAmpHrs has an error in it.
 
R

RoyVidar

Tirelle said:
I am trying to create a recordset based on a query. Each time i run
code, I get the following error:
-2147217900:Invalid SQL statement,expected
'DELETE','INSERT','PROCEDURE','SELECT',or 'UPDATE'.

Here is the statement... rst.Open "qryCalculateAmpHrs",
CurrentProject.Connection, adOpenDynamic, adLockOptimistic, accmdtexT
How do I resolve this?

Try changing adCmdText to adCmdStoredProc

BTW, if this is Jet data, I doubt you will get dynamic. Better go for
keyset or static (it will be coerced to keyset anyway, I think, if it
is based on Jet data).
 
R

RoyVidar

Tirelle said:
Tried all below... No success. Yes this is Jet data. Anymore
suggestions?

Describe "No success", in terms of (errornunmber), errormessage and
current code please (toss in the SQL too?).
 

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

Top