Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2010

    Unanswered: How to create a Multi User login with user levels

    I need to create a multi-user with user levels such as admin, and read only access database I created. I curently made a login with a password to get in the database but I want to only allow certain people to just have read-only access. I may have to discard the login I created that I found on line to make this work. I have Access 2007 and I have the database split (FE and BE).

    Is there a vbscript with directions that I can use to pull their network login as their username and the password I supply them which will give them the appropriate security level I set for them?


  2. #2
    Join Date
    Mar 2009
    Provided Answers: 14
    Yes you can use the following function to retrieve the Windows (or Domain) User ID (which is always valid as otherwise the Windows session would not be open). Copy this code and paste it in an independant module:
    ' This must go in the Declaration section of the module.
    Private Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long
    Public Function GetNTUser() As String
    ' Retrieve the ID of the currently connected user
    ' Usage: Dim strUserName as String
    '        strUserName = GetNTUser
        Dim strUserName As String
        Dim lngUserNameSize As Long
        strUserName = String$(255, 0)
        lngUserNameSize = Len(strUserName)
        GetUserName strUserName, lngUserNameSize
        GetNTUser = Left$(strUserName, lngUserNameSize - 1)
    End Function
    Have a nice day!

Posting Permissions

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