Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2004

    Unanswered: Get Mode of Current DB (exclusive or not)


    I'm setting up a DB where I do not want to set up security and I was wondering if there was any way to find out through VBA, or whatnot, if the database has been opened in exclusive mode or shared mode. I want to restrict updating unless its open in exclusive mode. I've thought of a strange way to do it (going out to the directory and seeing if the .ldb file exists, and using that as my determinant). Is there a better way to figure it out?


  2. #2
    Join Date
    Feb 2004
    Chicago, IL
    Look into the AllPermissions property. Looking for the .LDB will not tell you. The .LDB is created regardless of whether there is security or not.

  3. #3
    Join Date
    Feb 2004
    Thanks for the info man. I think the AllProperties will tell me if the user has exclusive mode. When I try to write it in VBA though (or try the MSDN example below), I get a compile error that it doesn't recognize the database or container type. Is it like java where I have to import anything? I'm still a bit new to VBA.

    Here's the code:

    Example (Microsoft Access)

    The following example checks the AllPermissions property for the Forms Container object and determines whether the user specified by the UserName property has full access to forms.

    Note The And operator performs a bitwise comparison to determine what permissions are currently set.
    Sub CheckAllPermissions()
    Dim dbs As Database, ctr As Container

    ' Return reference to current database.
    Set dbs = CurrentDb
    ' Return reference to Forms container.
    Set ctr = dbs.Containers!Forms
    ' Check if AllPermissions property includes full access.
    If (ctr.AllPermissions And dbSecFullAccess = dbSecFullAccess) Then
    MsgBox "User " & ctr.UserName & " has full access to all forms."
    End If
    Set dbs = Nothing
    End Sub
    Here's the link:


Posting Permissions

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