Cannot open Access database on CD

B

Bo Hansson

In my Word VBA application I would like to open an Access Database on a CD,
but get an error message telling me that it cannot be opened because it is
"either locked by another user or you need permission to read it". However,
none of these conditions are fulfilled as far as I undestand. If I copy the
database to the hard disk it works as expected. What fails is the following
line of code:

Set dbsDok = OpenDatabase(strDatabas)


What's the problem ?

/BosseH
 
J

Jezebel

The problem is that a file on CD is necessarily read-only, and your
instruction is trying to open the database for read/write. If you do it with
the file on your hard disk, you'll see that a new file appears in the same
folder -- same stem as the database file, with the extension .ldb -- this is
the lock file, to control multi-user access. With the file on CD, the system
is unable to create this lock file, so the open fails.
 
B

Bo Hansson

Thank you - now it is obvious!


/BosseH


Jezebel said:
The problem is that a file on CD is necessarily read-only, and your
instruction is trying to open the database for read/write. If you do it
with the file on your hard disk, you'll see that a new file appears in the
same folder -- same stem as the database file, with the extension .ldb --
this is the lock file, to control multi-user access. With the file on CD,
the system is unable to create this lock file, so the open fails.
 

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