Results 1 to 4 of 4
  1. #1
    sud2017 is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jul 2017
    Posts
    148

    Login Form Help


    Hi Experts,

    I need a help with my login form which contains below provided code. Problem is, for example, my login page gives message 'correct login ID and Password' when both 1234 and 12345 are entered as passwords, when the correct password is 1234. There seems to be something missing in my code, for which i would really appreciate your help. Thanks in advance.

    Private Sub CmdOK_Click()
    If IsNull(Me.txtLoginID) Then
    MsgBox "Please Enter LoginID", vbInformation, "LogID Required"
    Me.txtLoginID.SetFocus
    ElseIf IsNull(Me.txtPassword) Then
    MsgBox "Please Enter Password", vbInformation, "Password Required"
    Me.txtPassword.SetFocus
    Else
    'process the job
    If (IsNull(DLookup("UserLogin", "LoginT", "UserLogin ='" & Me.txtLoginID.Value & "'"))) Or _
    (IsNull(DLookup("Password", "LoginT", "Password ='" & Me.txtPassword.Value & "'"))) Then
    MsgBox "Incorrect LoginID or Password"
    Else
    MsgBox "LoginID and Password correct"
    End If
    End If
    End Sub

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,816
    Please post lengthy code between CODE tags to retain indentation and readability.

    Someone in the table must have password 12345. Your code is not restricting search to specific user.

    Don't really need to include the lookup on UserLogin. If the UserLogin is not valid, no password will return.

    If DLookup("Password", "LoginT", "UserLogin ='" & Me.txtLoginID & "'") & "" <> Me.txtPassword Then
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    orange's Avatar
    orange is online now Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,716
    Google using the following criteria youtube steve bishop login form
    to find a few free videos on setting up a user Login form.

  4. #4
    sud2017 is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jul 2017
    Posts
    148
    Thank you very much June7 and orange. It works great now!

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

Similar Threads

  1. Replies: 4
    Last Post: 07-17-2015, 10:04 AM
  2. Replies: 2
    Last Post: 04-17-2015, 10:59 AM
  3. Replies: 3
    Last Post: 03-17-2014, 10:23 AM
  4. Replies: 1
    Last Post: 12-11-2011, 11:48 AM
  5. Login form with nt login
    By hitesh_asrani_j in forum Forms
    Replies: 6
    Last Post: 09-22-2011, 11:43 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