What is wrong with this code?

I

Ivan

Hello,

in the Access 2003 mdb I used thise code to open a (stored) select query
qrySomeName as a recordset:

Dim rst As ADODB.Recordset
Set rst = New ADODB.Recordset
rst.ActiveConnection = CurrentProject.Connection
rst.Source = "qrySomeName"
rst.LockType = adLockOptimistic
rst.CursorType = adOpenForwardOnly
rst.Open

After I moved to Access 2007 I am geting but the error with description:
"Invalid SQL statement; expected 'DELETE', 'INSERT', 'PROCEDURE', 'SELECT',
or 'UPDATE'.

What is wrong with my code?

Ivan
 
D

danlock2

I would expect that it is a problem with your query. Can you tell me
what your query code is?
 
I

Ivan

I found the reason for the error. Before converting to A2007 I have also
changed some date criteria in my query so that it was dependent on textbox
of the form. I coud open the query but the query was not OK for the VB. I
had later also problems with international date format which is not allowed
in VB (in VB you must use United States date format!) . To avoid such
problem I writed later SQL statement directly into the code so that I
translate my non US date format.

Ivan
 

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