Jeff,
Believe it or not. This happens to many developers.
When you first create the database, it is in "exclusive" mode.
Upon exiting the database, Access remembers that you last used the database
was exclusive mode.
If you later fire up Access and choose to open the same database from "most
recent used list", Access assume you still want to open it in exclusive
mode.
The problem you descript below will occurred if it's open in exclusive mode.
Resolution:
From Access, Click File> Open, then browse to the database and click "Open"
button (it's a drop down box with 4 choices).
When I was new at building MS Office applications, I ran into this problem.
It took me hours of researching and finally found an article in MS KB on
this but I can find it now. Otherwise I'd include that link here. That was a
long time ago with Access 97. I can't believe in XP it's still the same way.
If anyone from MS is reading this, please suggest improvement on future
version. When open from the "most recent used list", give the end user a
warning, if the database is open as exclusive mode. Simply let user know
that it is been open as exclusive mode. Or like Excel's Shared Workbook,
indicate that on the menu bar will do.
Regards,
-matt-
Quote:
> I am currently running into an error when trying to make an ADO connection
> within an Access XP database.
> The error message is:
> "Database has been placed in a state by user "admin" on machine "dev" that
> prevents it being opened or locked"
> and occurs at the "dbConnect.Open....." statement.
> My code to connect is basically
> Dim dbConnect as ADODB.Connection
> Dim rstTable as ADODB.Recordset
> Dim strTablename as string
> strTablename = "tblBrisbane"
> Set dbConnect = New ADODB.Connection
> Set rstTable = New Recordset
> dbConnect.Open Application.CurrentProject.Connection
> rstTable.Open strTablename, dbConnect, adOpenDynamic, adLockOptimistic,
> adCmdTable
> I feel it may be that the connection has not previously been closed
> correctly, such as when debugging the code in another procedure, however,
I
> now still get the error even after re-booting my system.
> If anyone could point me in the right direction for a solution, I would be
> most greatful.
> Regards
> Jeff