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 / December 2005

Tip: Looking for answers? Try searching our database.

File Locking

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
BlockNinja - 06 Dec 2005 03:41 GMT
Does anyone have some good code for checking to see whether or not a file is
locked in VBA/Access?

I am needing to do 2 different things here:
1) Check a text file to see if it is locked by another user before opening
it with a FileSystemObject to avoid errors.
2) Check an Access database to see if it is locked before opening it.
Note: I've figured out that just checking for a .ldb file is insufficient
for checking for a locked Access database.  If I have read-only access to a
directory holding a database and open that db, it will tell me that I have
read-only access.  When someone else with read access attempts to open it,
despite if there's a lock file or not (in this case there won't be one), they
will still get a read-only message.

If the file is locked by a user on the network, I want to be able to get
their user name (I imagine this is done via a win32 api call since you can do
"dir /q" from a cmd prompt and get the process owner), and then shoot them a
message telling them politely to get out, then wait for the file(s)/db(s) to
be available.
Alex Dybenko - 06 Dec 2005 07:12 GMT
Hi,
to check if database locked -  you can open it in exclusive mode, it you get
error - then somebody have opened it.
to get names who logged in - you can use following code:
http://www.mvps.org/access/general/gen0034.htm

Signature

Alex Dybenko (MVP)
http://alexdyb.blogspot.com
http://www.PointLtd.com

> Does anyone have some good code for checking to see whether or not a file
> is
[quoted text clipped - 21 lines]
> to
> be available.
 
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.