+ Reply to Thread
Results 1 to 2 of 2

Login ID form not working

  1. #1
    Registered User
    Join Date
    06-29-2011
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    8

    Login ID form not working

    Hi,

    I am trying to create a login id and password form in Access 2007. I got this code from a site, however when implemented, it is constantly showing an error "Invalid Password. Please try again" even when passwords are correct. I have tried almost every possible thing. Also the last part of three failed attempts is not working. Kindly check the code below and please help with the possible error. Any information would be of great help.



    Private Sub Combo2_AfterUpdate()
    Me.Text2.SetFocus
    End Sub



    Private Sub Command6_Click()

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

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

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

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

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

    If Me.Text2.Value = DLookup("strEmpPassword", "tblEmployees", _
    "[lngEmpID]=" & Me.Combo2.Value) Then
    DoCmd.Close acForm, [frmlogon], acSaveNo
    DoCmd.OpenForm "frmSplash_Screen"
    Else
    MsgBox "Password Invalid. Please Try Again", vbOKOnly, _
    "Invalid Entry!"
    Me.Text2.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 admin.", _
    vbCritical, "Restricted Access!"
    Application.Quit
    End If

    End Sub

    Thanks in Advance
    Aman

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Login ID form not working

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1