Database state Error 
Author Message
 Database state Error

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



Sat, 14 May 2005 15:21:52 GMT  
 Database state Error
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



Mon, 16 May 2005 14:18:51 GMT  
 Database state Error
Matthew,
    Thanks so much for this information...it has solved my problem. I
thought that I had been missing some fundamental item in my code.

Regards
Jeff


Quote:
> 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-



> > 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



Mon, 16 May 2005 15:50:19 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Cannot open database because the database is in an unexpected state

2. ADO Connection State Does Not Reflect Actual Connection State

3. database state

4. Database loses its complied state

5. View State Error

6. View State Error

7. invalid cursor state error

8. tds state machine error

9. Error 8015 Could not set comm state

10. VB6: Winsock error - Invalid Oporation at Current State

11. SQL (server) State Error = :IM002

12. Error: Session State is not available in this context

 

 
Powered by phpBB® Forum Software