• How do I check if an Access Db is open

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » How do I check if an Access Db is open

    Author
    Topic
    #459189

    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?

    Viewing 0 reply threads
    Author
    Replies
    • #1157071

      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?

      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.

      • #1157645

        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

    Viewing 0 reply threads
    Reply To: How do I check if an Access Db is open

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: