Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ADODB.Connection giving error on Open

Status
Not open for further replies.
Jun 9, 2004
15
GB
I am developing an App in Access 2003 and prior to this have always used DAO for the coding. (I know, get with the times etc [pipe])
I thought I would use this project to move to ADO but have come across a problem.

I was trying to do an ADO connection so I could use a transaction around a number of updates.


code:
--------------------------------------------------------------------------------
Set con_db = New ADODB.Connection

con_db.CursorLocation = adUseClient
con_db.Mode = adModeShareDenyNone

con_db.Open CurrentProject.Connection

con_db.BeginTrans
--------------------------------------------------------------------------------


The trouble is the Open returns me an error message "The database has been placed in a state by user 'Admin' on machine....."

The database has no password, no security setup in workgroups at the moment.
The database is set to shared.

If I just use a recordset;

code:
--------------------------------------------------------------------------------
Set rec_ard = New ADODB.Recordset
rec_ard.CursorLocation = adUseClient

rec_ard.Open "reservation_detail", CurrentProject.Connection, adOpenKeyset, adLockOptimistic
--------------------------------------------------------------------------------


It works fine, so why not the connection object for transaction control? [3eyes]

Sounds like an obvious lock but Admin account has full access, No DB password, set as shared etc etc
What little bit am I missing ?

Hope you can help.
 
Never mind, Worked it out.
Another on of Access'es Idiosyncrasies.

Going into design mode/ vba debug does an exclusive lock on the DB.
Had my breakpoint before the .open so it was locked before the command was called.
Did my breakpoint after the open command and it worked [ponder]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top