Testing the DB Status

  • Thread starter Eddie's Bakery and Cafe'
  • Start date
E

Eddie's Bakery and Cafe'

Hi, I am using ADODB methods to open and read a database. In doing so, I
frequently get run-time errors that tell me the database is "Locked". I
would like to add logic before the db open statement (i.e., cnn.open) that
determines if the database is open or locked.

I would appreciate any feedback on how to test the status of a database. A
code sample would be great.

The ISSUE: For some unknown reason, when I switch between “Form-View†and
“Design-Viewâ€, I get a nasty run-time error. The error message is: “The
database has been placed in a state by user ‘Admin’ on machine … that
prevents it from being opened or locked.

I indirectly initiate a db open operation from the “Form_Load()†event
routine. In the Form_Load() sub, I call another routine (in another class
module) that does the actual db open.

If you have any idea what is going on, I would really appreciate your
feedback.

Thanks,
 
M

Mark A. Sam

Hello Eddie,

I don't know about testing the "locked" state of the database. I have
encountered the same thing on a client's machine running Access 2000 (amoung
a myriad of other issues). The database as far as I know shouldn't lock you
out. It has to be a bug. I don't encounter this with Access 2002 and
haven't on any other version.


I know that doesn't solve your problem, but it may help if you look for a
patch to fix this rather than a method.

God Bless,

Mark
 
E

Eddie's Bakery and Cafe'

Thanks Mark for your feedback, I will keep searching and Lord willing I will
find a solution.

Regards,

Eddie
 
6

'69 Camaro

Hi, Eddie.
I
would like to add logic before the db open statement (i.e., cnn.open) that
determines if the database is open or locked.

One can programmatically determine whether a database is open by using the
code sample in the Microsoft KB article, "How to determine who is logged on
to a database by using Microsoft Jet UserRoster in Access 2002 or in Access
2003" on the following Web page (with a link to the Access 2000 version):

http://support.microsoft.com/default.aspx?id=285822

If you'd like to visually check whether a database is open, and by whom,
while debugging, then Microsoft's LDB Viewer is a tool which can be used to
view the users of any Access database on the network. You may find a link to
this tool and other free diagnostic tools in the "Free Microsoft Access
Troubleshooting Tools" section on this Web page:

http://www.Access.QBuilt.com/html/links.html

The only tool I know of available to the public for checking Microsoft
Access database locking information is Microsoft's Database Page Lock Viewer,
which is a utility for checking specific locks on tables and data pages in
the database. However, this tool was designed for Microsoft Access 95 and
had limited functionality in Access 97, if I remember correctly. It doesn't
work in Jet 4.0 databases, and Microsoft has not updated the tool.

I suspect that after using the code or the LDB Viewer to see what's going
on, you'll find that it's you who is opening the database and putting it into
a "suspect state," which prevents you from programmatically opening another
database file, since you'll get "The database has been placed in a state by
user ‘Admin’ on machine … that prevents it from being opened or locked" error
message when this happens.

Please let me know if you find that the current database is put into a
suspect state as soon as the code to open the other database executes.

HTH.

Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips.

(Please remove ZERO_SPAM from my reply E-mail address, so that a message
will be forwarded to me.)

- - -
When you see correct answers to your question posted in Microsoft's Online
Community, please sign in to the Community and mark these posts as "Answers,"
so that all may benefit by filtering on "Answered questions" and quickly
finding the right answers to similar questions. (Only "Answers" have green
check-marks.) Remember that the best answers are often given to those who
have a history of rewarding the contributors who have taken the time to
answer questions correctly.
 
6

'69 Camaro

Please let me know if you find that the current database is put into a
suspect state as soon as the code to open the other database executes.

Or if the current database is put into a suspect state as soon as the form
is switched to the other view mode, for that matter.

HTH.

Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips.

(Please remove ZERO_SPAM from my reply E-mail address, so that a message
will be forwarded to me.)

- - -
When you see correct answers to your question posted in Microsoft's Online
Community, please sign in to the Community and mark these posts as "Answers,"
so that all may benefit by filtering on "Answered questions" and quickly
finding the right answers to similar questions. (Only "Answers" have green
check-marks.) Remember that the best answers are often given to those who
have a history of rewarding the contributors who have taken the time to
answer questions correctly.
 
E

Eddie's Bakery and Cafe'

Hi, Thanks for all your suggestions, but I am confused as to what you mean by
marking posts as "Answers". I am new to Access development and the
Discussion Group.

Am I supposed to write "Answers" in the subject or message body???

Thanks for all your help,

Eddie
 
E

Eddie's Bakery and Cafe'

Hi Again, I found in the help menu how to rate a response:

1) In the thread pane, select the post that is a response to a question you
asked.
2) In the message pane, do one of the following:

a) If the post answers your question, click Yes next to Did this post answer
the question?
b) If the message was not helpful to you, click No next to Did this post
answer the question?

Once again, thanks for your help
 

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