Results 1 to 4 of 4
  1. #1
    jtm013 is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Aug 2014
    Posts
    117

    Help with login

    Hello, I have a login screen which is working well, with the exception that my attempt to limit the max number of attempts at login is not working.
    I am still new to VBA so I'm sure I am just overlooking something.

    Thanks,

    Private Sub VerificationButton_Click()




    'Check to see if data is entered into the UserName combo box


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


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


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


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


    If Me.txtPassword.Value = DLookup("Pwd", "Tbl_Log_In_Data", _
    "[EmpNumber]=" & Me.cboEmployee.Value) Then


    EmpNumber = Me.cboEmployee.Value


    'Close logon form and open splash screen


    DoCmd.Close acForm, "frmLogon", acSaveNo
    DoCmd.OpenForm "Suggestion Review Form"


    Else
    MsgBox "Password Invalid. Please Try Again", vbOKOnly, _


    "Invalid Entry!"
    Me.txtPassword.SetFocus
    End If


    'If User Enters incorrect password 2 times database will shutdown


    intLogonAttempts = intLogonAttempts + 1
    If intLogonAttempts > 2 Then
    MsgBox "You do not have access to this database.Please contact admin.", _
    vbCritical, "Restricted Access!"
    Application.Quit

    End If


    End Sub

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    If you resolved this issue, do you care to share your solution with others that read these forums?

  3. #3
    jtm013 is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Aug 2014
    Posts
    117
    I would...but I don't know how I fixed it. All I know is after messing with the code for the better part the morning it started working. The final code looks identical to what is shown above, so I'm not sure what changed, but it works now.

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Okay! Thanks for trying.

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

Similar Threads

  1. User Login
    By winterh in forum Forms
    Replies: 6
    Last Post: 03-14-2012, 06:01 PM
  2. Login form with nt login
    By hitesh_asrani_j in forum Forms
    Replies: 6
    Last Post: 09-22-2011, 11:43 AM
  3. Login to a form?
    By tandkb in forum Forms
    Replies: 0
    Last Post: 04-25-2011, 06:05 PM
  4. Login VBA
    By mjhopler in forum Forms
    Replies: 3
    Last Post: 02-11-2010, 02:28 AM
  5. app.login
    By seen in forum Access
    Replies: 3
    Last Post: 07-18-2009, 01:19 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