opening .mdb database on network read only

R

Rainer

I am trying to find a solution for this:
We have a .mdb database on a network share, which is read only. I can simply
doubleclick that file, open it in access, then copy some content and paste
it into excel. Now I want to do that programmatically via an Excel VBA
macro. But I dont get to open the database.
I tried:
Dim Db as DAO.Database
set Db = DBEngine.OpenDatabase(path, false, true)
-> results in "cannot lock file"

Then I tried:
Dim Db as DAO.Database
set Db = DBEngine.OpenDatabase(path, true, true)
-> You dont have sufficient permissions to work on that file..."

Then I tried ADO:
Dim Dba as ADODB.Connection
set Dba as New ADODB.Connection
Dba.Mode = adModeRead
Dba.ConnectionString = "Driver={Microsoft Access Driver (*.mdb)}; DBQ=path"
Dba.Open
-> not sufficient permissions...

So how th F... can I open the file via vba? I mean I can open it manually by
just clicking it (if I do, In access a message appears "The database is
write protectet...", but that is sufficient for my purpose), so there ought
to be a way to access the file programmatically, or isnt?
 

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