Results 1 to 3 of 3
  1. #1
    5 Star Lounger
    Join Date
    May 2001
    Location
    Patterson Lakes, Melbourne, Victoria, Australia
    Posts
    637
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Is there a simple way to check if an Access Db is open on another computer on the network?
    I currently have been renaming the Dbs to the same name. [Name ChkDbs As ChkDbs]. If it works the Db obviously isn't open. If there is an error then the Db probably is open. However the Dbs are replicated and renaming them might just lead to errors.
    Any ideas anyone?
    Regards,
    Peter

  2. #2
    5 Star Lounger
    Join Date
    Apr 2003
    Location
    Hampshire, United Kingdom
    Posts
    602
    Thanks
    0
    Thanked 0 Times in 0 Posts
    [quote name='Peter Kinross' post='771353' date='20-Apr-2009 14:47']Is there a simple way to check if an Access Db is open on another computer on the network?
    I currently have been renaming the Dbs to the same name. [Name ChkDbs As ChkDbs]. If it works the Db obviously isn't open. If there is an error then the Db probably is open. However the Dbs are replicated and renaming them might just lead to errors.
    Any ideas anyone?[/quote]
    Usually an access database (stored as an .mdb file) will generate a lock file (an .ldb file) in the same folder as the main database file when it's open. If you open that lock file in a text editor, you can usually see the names of the computers that have the database open.

    This method isn't foolproof - if a user manages to crash their copy of Access for example, the lock file won't be updated with the fact they no longer have it open - but it's handy for the most part.
    Waggers
    If at first you do succeed, you've probably missed something.

  3. #3
    5 Star Lounger
    Join Date
    May 2001
    Location
    Patterson Lakes, Melbourne, Victoria, Australia
    Posts
    637
    Thanks
    0
    Thanked 0 Times in 0 Posts
    This method isn't foolproof - if a user manages to crash their copy of Access for example, the lock file won't be updated with the fact they no longer have it open - but it's handy for the most part.

    Yep, this method sure isn't foolproof. Many a time I have found stray .ldb files when the Db has been long closed.
    However I found a simple way of testing if a file is open or locked:
    Open DbThis For Binary Access Read Write Lock Read Write As #1
    Close #1
    If you get an error the file is open or locked
    Regards,
    Peter

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •