reading db file attributes

G

Guest

How can you read the file attributes of an mdb file within VBA? I need to
determine if the currently open mdb is ReadOnly, and we've got Access 97,
2000, XP, and 2003.

Thanks
Vern
 
G

Guest

I found it. Haven't yet confirmed that it works on 97, 2000, XP, and 2003.

GetAttr(Application.CurrentProject.FullName) And vbReadOnly

Vern
 
D

Dirk Goldgar

Vern Rabe said:
I found it. Haven't yet confirmed that it works on 97, 2000, XP, and
2003.

GetAttr(Application.CurrentProject.FullName) And vbReadOnly

It won't work for Access 97, as A97 has no "CurrentProject" property.
However, in any of these versions you ought to be able to use
CurrentDb.Name instead, unless you're working in an ADP:

GetAttr(CurrentDb.Name) And vbReadOnly

That won't work in an ADP, unfortunately, as CurrentDB returns Nothing
in an ADP.

Be aware that checking the read-only file attribute won't tell you if
the file is read/write but it's currently *opened* for read-only access.
 

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