OpenRecordset & SQL 6.5

B

B.

I have problem with opening recordset using access query.

Set rst = CurrentDb.OpenRecordset("users", dbOpensnapshot)

"users" is query that uses linked table to SQL 6.5.

I get:
Run time error 3001
Invalid argument

I tried dbSeeChanges, dbReadonly but it didn't work too.
Using dbSeechanges gives error that SQL table has identety column.

Any suggestion?

Maybe to do it in some other way.

Thanks in advance.

B.
 
B

B.

Arvin Meyer said:
If the query "users" will open by itself and return the correct data, try
using just:

Set rst = CurrentDb.OpenRecordset("users")

In that case it says:
You must use dbSeeChanges option with Openrecordset when accessing a SQL
Server table
that has an IDENTITY column.

I consulted with our DBA for MS SQL and he suggested using dbOpensnapshot
option.
I also tried dbSeeChanges but it doesn't work.

I checked syntax 1000 times and tried a dozen suggestions from www.mvps.org

Query is working properly when I open it.

B.
 
B

B.

BTW, I use MS Access 2000

B.


B. said:
In that case it says:
You must use dbSeeChanges option with Openrecordset when accessing a SQL
Server table
that has an IDENTITY column.

I consulted with our DBA for MS SQL and he suggested using dbOpensnapshot
option.
I also tried dbSeeChanges but it doesn't work.

I checked syntax 1000 times and tried a dozen suggestions from www.mvps.org

Query is working properly when I open it.

B.
 
A

Arvin Meyer

Make sure that you have the correct reference. An Access 2000 database uses
ADO by default. Your code is DAO code. Make sure the DAO reference is set
(Tools ... References in a code window). If both are used, disambiguate your
code by including an explicit reference:

Dim db As DAO.Database
Dim rst As DAO.Recordset
Set db = CurrentDb
Set rst = db.OpenRecordset("users", dbOpensnapshot)
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:
http://www.datastrat.com
http://www.mvps.org/access
 

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