Saving design changes in Access 2000 locks out ADO, why?

M

Michael Edwards

I have Access 2000 with some DAO and some ADO code. If I make any design
changes and save them, I must close and re-open the database to run any ADO
code. Otherwise I get the following message:

"The database has been placed in a state by user 'Admin' on machine 'X' that
prevents it from being opened or locked."

Is this normal? Is there a work around?
 
G

Guest

Michael,
No that behaviour is not normal. I assume you've done a
compact and repair, checked the VBA library references and
are not opening the mdb file exclusively.

I've thought of a few things for you to try:-
First...
Assuming that you are the only user connected
to 'yourappname'.MDB file then close it and Acc2k. Then
use Windows Explorer to check for the presence of a file
called 'yourappname'.LDB in the same folder as your
application file ('yourappname'.MDB). If it exists AFTER
closing your application AND Acc2k AND you are the only
user of that application then delete that LDB file.
Since either Acc95 or Acc97 (I can't remember which
offhand) Access automatically deletes LDB files when the
last user in an application closes it. LDB Files are
Access lock files and can sometimes get corrupted. Access
can also get confused and fail to delete the file.

Second...
Acc2k stores the definition of objects in a database quite
differently from preceding versions. When you change any
object and save it they are all re-saved. As your
application gets bigger and more complex things can get
somewhat confused. It might be worth trying a decompile
on your application, this is undocumented and unsupported
so definately back up! Back up your mdb first then open a
dos window and type "msaccess
yourappname.mdb /decompile". When that's done, reopen
access and your application, recompile everything, close
access and reopen.

Third...
Open a new database and import all your objects from the
old one into the new one.

Best of luck,

Nick Coe, Lincoln, UK
Accessing since 94
classicnick at yahoo dot com
 
D

david epsom dot com dot au

Saving design changes means that you have an exclusive lock on the whole
database. No 'other person' can connect to the database until you release
the exclusive lock. The only way to release the exclusive lock is to
close the database.

The only way to work around this with ADO is to make sure that you are
using the SAME CONNECTION, not creating a new connection.

You can get the current connection object from
Application.CurrentProject.Connection

(The default property of the object is the ConnectionString: don't
confuse that with the connection object)

(david)
 

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