Recordset based on Query

  • Thread starter Thread starter Guest
  • Start date Start date
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?
 
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.
 
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).
 
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?).
 
Back
Top