Results 1 to 6 of 6
  1. #1
    Join Date
    Oct 2007
    Posts
    225

    Question Unanswered: Username Question

    Hi All,

    I have a table that holds USERNAMES and SIGNATURES. Is there a way, to assign each user a password, so when they log on to the data base they will be the assigned user and their signature will be the only one usable within the forms I have? Right now on each form there's a dropdown in which the username is chosen and the chosen username and associated signature reflects on reports etc.

    Also, I'm using access 2016. Are there any other means of securing this database aside from the method built on the application?


    Thank you!

  2. #2
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    629
    Provided Answers: 33
    you can use the Windows login to verify the person.
    put the userID in a table, with the signatures.
    When the db opens, the startup form is the login page. Fill in the userID automatically at form load:
    vUserID = Environ("Username")
    txtUSer = Dlookup("[userID]","tUsers","[userID]='" & vUserID & "'")


    The user enters their windows password. If the userID is in the table AND the password is correct, then
    the user is allowed into the next form.
    Then lookup that persons rights in order to enable/disable controls.
    Code:
       
    sub btnLogin_click()
    If WindowsLogin(txtUser, txtPass, txtDom) Then
       DoCmd.OpenForm "frmMainMenu"
       DoCmd.OpenForm "frmLogin"
       DoCmd.Close
    Else
       MsgBox "LOGIN INCORRECT", vbCritical, "Bad userid or password"
       'docmd.quit   'exit access
    End If
    end sub
    
    
    
    Public Function WindowsLogin(ByVal strUserName As String, ByVal strpassword As String, ByVal strDomain As String) As Boolean
            'Authenticates user and password entered with Active Directory.
    
            On Error GoTo IncorrectPassword
            
            Dim oADsObject, oADsNamespace As Object
            Dim strADsPath As String
            
            strADsPath = "WinNT://" & strDomain
            Set oADsObject = GetObject(strADsPath)
            Set oADsNamespace = GetObject("WinNT:")
            Set oADsObject = oADsNamespace.OpenDSObject(strADsPath, strDomain & "\" & strUserName, strpassword, 0)
            
            WindowsLogin = True    'ACCESS GRANTED
            
    ExitSub:
            Exit Function
            
    IncorrectPassword:
            WindowsLogin = False   'ACCESS DENIED
            Resume ExitSub
    End Function

  3. #3
    Join Date
    Oct 2007
    Posts
    225
    I see what you're saying about using the windows login. I was curious if there is any way within access to create a table with usernames and passwords, that restrict users from certain aspects of the data base until they enter their password. For instance, if a user wants to go into admin functions, they can't access it until they know a password.

  4. #4
    Join Date
    Feb 2004
    Location
    New Zealand
    Posts
    1,482
    Provided Answers: 11
    like you thinking BUT making it hard for your user

    What i do is set up User in 3 groups User/Managers/Admins

    then in the TAG of the object i put User or Manager or Admins

    have some code that run when the form is open it get the tag value make it visible or not

    admins can see all
    Manager can see manages and Users
    User can see Users only
    hope this help

    StePhan McKillen
    the aim is store once, not store multiple times
    Remember... Optimize 'til you die!
    Progaming environment:
    Access based on my own environment: DAO3.6/A97/A2000/A2003/A2007/A2010
    VB-NET based on my own environment started 2007
    SQL-2005 based on my own environment started 2008
    YOUR PASSWORD IS JUST LIKE YOUR TOOTHBRUSH DON'T SHARE IT.
    DONT WORRY ABOUT THOSE WHO TALK BEHIND YOUR BACK
    THEY'RE BEHIND YOU FOR A REASON

  5. #5
    Join Date
    Oct 2007
    Posts
    225
    I see what you're saying. Do you happen to have a more detailed example of this? I'm still learning a bit with access so I apologize if I need some clarifications. Thanks!

  6. #6
    Join Date
    Feb 2004
    Location
    New Zealand
    Posts
    1,482
    Provided Answers: 11
    Here this should get you started

    Code:
    Dim ctl As Control
    For Each ctl In frm.Controls
            If ctl.ControlType = acTextBox Or ctl.ControlType = acComboBox Or ctl.ControlType = acListBox Then
                If InStr(1, ctl.Tag, "*") <> 0 Then
                    ctl.BackColor = setColour
                End If
            End If
    Next ctl
    Set ctl = Nothing
    hope this help

    StePhan McKillen
    the aim is store once, not store multiple times
    Remember... Optimize 'til you die!
    Progaming environment:
    Access based on my own environment: DAO3.6/A97/A2000/A2003/A2007/A2010
    VB-NET based on my own environment started 2007
    SQL-2005 based on my own environment started 2008
    YOUR PASSWORD IS JUST LIKE YOUR TOOTHBRUSH DON'T SHARE IT.
    DONT WORRY ABOUT THOSE WHO TALK BEHIND YOUR BACK
    THEY'RE BEHIND YOU FOR A REASON

Posting Permissions

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