Error message on Access Form

L

LUZZEL

I have an Access form that originally used an Access Query (and therefore I
assume the Jet Engine) to populate a detail grid.
The form was changed to use ADO connections to a SQL server, which allowed
some incredible improvements in performance. The query string is a call to a
stored proc e.g. 'exec sp_ .....' The retrieved recordset is applied to the
form as follows:

Set Me.fsubItemSearch.Form.Recordset = rsSearchResults

Everything works fine except when you right click and sort on the grid, the
following error message comes up at least two times, and then the grid is
properly sorted.

"Invalid SQL statement. Experected 'DELETE','INSERT','PROCEDURE','SELECT',
or 'UPDATE'.

I assume that for some reason Access is trying to run the query string using
the jet engine, but I can find no place where I can disable whatever it is
doing. I haven't found any solution on the web as yet. Incidentally, if you
break on all errors, it never breaks. It just shows the error message.

Any ideas how to turn this behavior off?
 
B

Bob Buckland ?:-\)

Hi Luzzel,

You may want to use the link below to post this in the MS Office Access group and mention the version of Access, if known, that the
form was written to.

===========
I have an Access form that originally used an Access Query (and therefore I
assume the Jet Engine) to populate a detail grid.
The form was changed to use ADO connections to a SQL server, which allowed
some incredible improvements in performance. The query string is a call to a
stored proc e.g. 'exec sp_ .....' The retrieved recordset is applied to the
form as follows:

Set Me.fsubItemSearch.Form.Recordset = rsSearchResults

Everything works fine except when you right click and sort on the grid, the
following error message comes up at least two times, and then the grid is
properly sorted.

"Invalid SQL statement. Experected 'DELETE','INSERT','PROCEDURE','SELECT',
or 'UPDATE'.

I assume that for some reason Access is trying to run the query string using
the jet engine, but I can find no place where I can disable whatever it is
doing. I haven't found any solution on the web as yet. Incidentally, if you
break on all errors, it never breaks. It just shows the error message.

Any ideas how to turn this behavior off?>>
--
Please let us know if this has helped,

Bob Buckland ?:)
MS Office System Products MVP

LINKS
A. Specific newsgroup/discussion group mentioned in this message:
news://msnews.microsoft.com/microsoft.public.access
or via browser:
http://microsoft.com/communities/newsgroups/en-us/?dg=microsoft.public.access

B. MS Office Community discussion/newsgroups via Web Browser
http://microsoft.com/office/community/en-us/default.mspx
or
Microsoft hosted newsgroups via Outlook Express/newsreader
news://msnews.microsoft.com
 
Top