Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / September 2006

Tip: Looking for answers? Try searching our database.

reading db file attributes

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Vern Rabe - 18 Sep 2006 18:59 GMT
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
Vern Rabe - 18 Sep 2006 20:23 GMT
I found it. Haven't yet confirmed that it works on 97, 2000, XP, and 2003.

GetAttr(Application.CurrentProject.FullName) And vbReadOnly

Vern

> 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
Dirk Goldgar - 18 Sep 2006 22:48 GMT
> 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.

Signature

Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)

Vern Rabe - 20 Sep 2006 01:31 GMT
Thanks, Dirk. CurrentDb.Name did the trick.

Vern

> > I found it. Haven't yet confirmed that it works on 97, 2000, XP, and
> > 2003.
[quoted text clipped - 12 lines]
> 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.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.