PC Review


Reply
Thread Tools Rate Thread

Recordset based on Query

 
 
=?Utf-8?B?VGlyZWxsZQ==?=
Guest
Posts: n/a
 
      21st Feb 2007
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?

 
Reply With Quote
 
 
 
 
=?Utf-8?B?SmltIEJ1cmtlIGluIE5vdmk=?=
Guest
Posts: n/a
 
      21st Feb 2007
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" wrote:

> 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?
>

 
Reply With Quote
 
RoyVidar
Guest
Posts: n/a
 
      21st Feb 2007
"Tirelle" <(E-Mail Removed)> wrote in message
<663EC7A9-F3BA-4D39-8BE4-(E-Mail Removed)>:
> 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).

--
Roy-Vidar


 
Reply With Quote
 
=?Utf-8?B?VGlyZWxsZQ==?=
Guest
Posts: n/a
 
      21st Feb 2007
Tried all below... No success. Yes this is Jet data. Anymore suggestions?

"RoyVidar" wrote:

> "Tirelle" <(E-Mail Removed)> wrote in message
> <663EC7A9-F3BA-4D39-8BE4-(E-Mail Removed)>:
> > 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).
>
> --
> Roy-Vidar
>
>
>

 
Reply With Quote
 
RoyVidar
Guest
Posts: n/a
 
      21st Feb 2007
"Tirelle" <(E-Mail Removed)> wrote in message
<79862CE9-A760-4FE7-AE15-(E-Mail Removed)>:
> Tried all below... No success. Yes this is Jet data. Anymore
> suggestions?
>
> "RoyVidar" wrote:
>
>> "Tirelle" <(E-Mail Removed)> wrote in message
>> <663EC7A9-F3BA-4D39-8BE4-(E-Mail Removed)>:
>>> 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).
>>
>> --
>> Roy-Vidar
>>
>>
>>


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

--
Roy-Vidar


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
recordset.AddNew to RS based on query Kamil Microsoft Access 4 4th Aug 2008 12:03 PM
Recordset based on Query =?Utf-8?B?V2FoYWI=?= Microsoft Access VBA Modules 0 12th Oct 2006 09:47 AM
Query based recordset Brian Microsoft Access VBA Modules 8 10th May 2004 02:13 AM
Query based recordset Brian Microsoft Access Queries 7 9th May 2004 05:25 AM
Query based recordset Brian Microsoft Access Getting Started 7 9th May 2004 05:25 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:26 AM.