reading db file attributes

  • Thread starter Thread starter Guest
  • Start date Start date
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
 
I found it. Haven't yet confirmed that it works on 97, 2000, XP, and 2003.

GetAttr(Application.CurrentProject.FullName) And vbReadOnly

Vern
 
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.
 
Back
Top