Results 1 to 3 of 3
  1. #1
    Bradonnmorgan is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2013
    Location
    Ohio
    Posts
    13

    Multiple User login

    For starters My name is Bradon Morgan. Hello forum!
    I checked the forum for other instances of this issue but none of them seemed to cover everything I needed.

    I have a Access system were users can log in and a database that says who can and cant log in. (username/ password)


    From here I need to have it set up so that it keep the person logged in until they click a log-out button that will be located on all the forms.
    I also need the username of the person logged in to be displayed in a textbox somewhere on all the forms they have access to.
    This will also need to only give that person access to certain forms, this being said I could set each user a security level and once they log in use an if statement to display certain forms based on that.
    *** Do not want to display the windows log in info.

    If anyone could help I would greatly appreciate it. I can provide anymore information anyone needs.

    Thanks so much for the help!!!

  2. #2
    burrina's Avatar
    burrina is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2012
    Location
    Freeport,Texas
    Posts
    1,383
    You can put this in the oncurrent event of your form,adjust to your liking.

    Me.Caption = Environ("UserName") & " is logged on "

  3. #3
    rankhornjp is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Jul 2011
    Posts
    46
    I have a "Users" table that keeps up with Usernames, Passwords, and Security Levels. Then I have a User Login form that is set to load on open.

    When they click "OK" to log in this code runs:
    Code:
    Private Sub btnOK_Click()
    On Error GoTo help
    
    
    Dim db As Database
    Dim rs As Recordset
    
    
    
    
    Set db = CurrentDb
    Set rs = db.OpenRecordset("Select * from Users where username = '" & txtUserName.Value & "' AND password = '" & txtPassword.Value & "'")
    
    
    If rs.RecordCount = 0 Then
        'No user - authentication failed
        MsgBox "Invalid username or password! Please try again.", vbCritical, "Login Error ..."
        Exit Sub
    Else
        Level = rs.Fields("Level")
        DoCmd.Close
        DoCmd.OpenForm "frmMainMenu", acNormal
    End If
    
    
    Exit Sub
    
    
    help:
    
    
    If Err.Number <> 0 Then
           MsgBox Err.Description
    End If
    
    
    End Sub
    Then you can go to "MainMenu" Form_Load() and do something like this:

    Code:
    Private Sub Form_Load()
    'Setup permission load
    
    
    '1 = View/Edit User
    '2 = Admin User
    
    
    btnLogOut.SetFocus
    
    
        Main.Visible = False
        People.Visible = False
        
        
    
    
    'View Edit User
    If Level = 1 Then
       
        'Main.Visible = True
        'People.Visible = False
         
        
    End If
    
    
    'Admin User
    If Level = 2 Then
        'admin user
        Main.Visible = True
        People.Visible = True
        
    End If
        
    End Sub
    Declare "Level" as a Public Variable (Interger)


    This will keep them logged in until they close the database or click "Log-out". Every time someone opens it they have to log-in. Not sure if that's what you were talking about.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. User Login Form
    By glen in forum Forms
    Replies: 21
    Last Post: 09-17-2012, 09:09 AM
  2. User Login
    By winterh in forum Forms
    Replies: 6
    Last Post: 03-14-2012, 06:01 PM
  3. Multi- User Login
    By Tom Lovick in forum Access
    Replies: 1
    Last Post: 02-11-2012, 12:20 PM
  4. Replies: 3
    Last Post: 09-22-2011, 03:35 PM
  5. Login and user levels
    By seanog2001 in forum Forms
    Replies: 0
    Last Post: 10-27-2009, 05:13 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums