Results 1 to 4 of 4

Thread: Access 2003 Login with Mutiple switchboards

  1. #1
    Join Date
    Feb 2009
    Posts
    4

    Access 2003 Login with Mutiple switchboards

    I have an access database (adp) with an login form. The form works great, logs in and then displays the default switchboard. I need it to baised on a value (numerical) to display the proper switchboard. The table that holds the user information has an UserID,Password, and DBAccess field. The dbaccess field holds the value (1,2,3,4,5). Ive created forms that i want to display after the login...eg bob is level 2 so level 2 form displays.

    heres the code to the current login, need help adding in the next step to display the proper switchboard form.

    Thanks.

    Private Sub cmdLogin_Click()
    'Check to see if data is entered into the UserName combo box

    If IsNull(Me.UserID) Or Me.UserID = "" Then
    MsgBox "You must enter a User Name.", vbOKOnly, "Required Data"
    Me.UserID.SetFocus
    Exit Sub
    End If

    'Check to see if data is entered into the password box

    If IsNull(Me.LoginPassword) Or Me.LoginPassword = "" Then
    MsgBox "You must enter a Password.", vbOKOnly, "Required Data"
    Me.LoginPassword.SetFocus
    Exit Sub
    End If

    'Check value of password in tblEmployees to see if this matches value chosen in combo box

    If Me.LoginPassword.Value = DLookup("EmpPassword", "tblLogin", "EmpLogin='" & Me.UserID.Value & "'") Then

    EmpLogin = Me.UserID.Value

    'Close logon form and open splash screen

    DoCmd.Close acForm, "frmLogon", acSaveNo
    DoCmd.OpenForm "frmMainMenu"

    Else
    MsgBox "Password Invalid. Please Try Again", vbOKOnly, "Invalid Entry!"
    Me.LoginPassword.SetFocus
    End If

    'If User Enters incorrect password 3 times database will shutdown

    intLogonAttempts = intLogonAttempts + 1
    If intLogonAttempts > 3 Then
    MsgBox "You do not have access to this database. Please contact your system administrator.", vbCritical, "Restricted Access!"
    Application.Quit
    End If

    End Sub

  2. #2
    Join Date
    Oct 2006
    Location
    Maitland NSW Australia
    Posts
    275
    You need to check for a valid access level and then open the relevant form depending on the access level. I have a sample Login form (not using adp) on another thread on this forum. Have a look at message 44 or later it has a zip file http://forums.databasejournal.com/sh...t=45488&page=3

    Module mod_display_menu will give some help with your coding.
    Please contact me if you require further assistance with the module.
    Allan

  3. #3
    Join Date
    Feb 2009
    Posts
    4
    Im new to VB Programming and need some clarification on your code. I have 4 levels and 4 forms to open. Any help is appreciated.

  4. #4
    Join Date
    Oct 2006
    Location
    Maitland NSW Australia
    Posts
    275
    Have a read of the attached document.

    In the module mod_display_menu you will need to add code in the CASE statement for the additional two levels of access.

    If you still have questions please contact me at the email address below.
    Attached Files Attached Files
    Allan

Posting Permissions

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