Recordset adLockReadOnly but still "currently locked by another user"!

A

Arnaud Lesauvage

Hello groups !

In a vbs script, I connect to an Access 2000 database and open a
recordset for in readonly mode :

Dim oConn
Dim oRS
Set oConn = CreateObject("ADODB.Connection")
Set oRS= CreateObject("ADODB.RecordSet")

oConn.Provider = "Microsoft.Jet.OLEDB.4.0"
oConn.Open "Data Source=M:\mydb.mdb;User
ID=myuser;Password=mypassword;Persist Security Info=True;Jet
OLEDB:System database=M:\systemdb.mdw"

oRS.Open "Select Count(*) FROM mytable WHERE
somefield='somevalue'", oConn, adOpenForwardOnly, adLockReadOnly

On this last line, I get an error 80004005 : "Could not save;
currently locked by another user".

I know that another user might be accessing the database at this
moment, but I just want a count in readonly mode, why do I have
this message about "could not save" ?


Thanks for your help !

Regards
 
A

Arnaud Lesauvage

Arnaud said:
oRS.Open "Select Count(*) FROM mytable WHERE
somefield='somevalue'", oConn, adOpenForwardOnly, adLockReadOnly

On this last line, I get an error 80004005 : "Could not save;
currently locked by another user".


It must be a pretty common error. Anybody has a clue ?

Regards
 

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