Results 1 to 6 of 6
  1. #1
    data808 is offline Noob
    Windows XP Access 2010 32bit
    Join Date
    Aug 2012
    Posts
    727

    Login Password field to press enter to validate and submit

    I have a login form that after the user types in the password, while still being in the password field, I would like to be able to press enter to act as if clicking the login button.

    I got assistance on this before and it had to do with the after update event which worked out ok until I discovered that if the user pressed tab to lose focus on this password field, it would also act like pressing enter. In other words tab would also log you in. I just want enter to be the button to execute the click login button event.



    Thanks

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,926
    Perhaps use the Change event. It will fire after each character is typed but should be fast and transparent to the user.
    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
    data808 is offline Noob
    Windows XP Access 2010 32bit
    Join Date
    Aug 2012
    Posts
    727
    That doesn't work. The prompt for wrong password or username comes up on each key press. I need it to be something like this. Btw, 13 = Enter:

    If KeyCode = 13 Then

    Do all this stuff:

    If txtUsername = "user1" And txtPassword = "user1" Then
    DoCmd.OpenForm "Splash Screen Load"
    ElseIf txtUsername = "user2" And txtPassword = "user2" Then
    DoCmd.OpenForm "Splash Screen Load"
    ElseIf txtUsername = "admin" And txtPassword = "admin" Then
    MsgBox "Access Granted", vbInformation, "Admin Area"
    MsgBox "Welcome admin user. Use caution when making changes.", vbInformation, "Admin Permissions"
    DoCmd.Close
    DoCmd.OpenForm "Main Menu_admin"
    ElseIf txtUsername = "user3" And txtPassword = "user3" Then
    DoCmd.OpenForm "Splash Screen Load"
    Else
    MsgBox "Username or Password invalid. Please re-enter Username and Password.", vbExclamation, "Invalid Criteria"
    End If

  4. #4
    data808 is offline Noob
    Windows XP Access 2010 32bit
    Join Date
    Aug 2012
    Posts
    727
    Found an easy solution. Go to the login button properties and under the Other tab, change the default property to yes. This will make the button execute on enter. Thanks for the help though.

  5. #5
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,926
    I see, never had need for this behavior, although might be one place I could use it. Was not aware of that property. Learned something new. Thank you.
    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.

  6. #6
    data808 is offline Noob
    Windows XP Access 2010 32bit
    Join Date
    Aug 2012
    Posts
    727
    Not a problem at all. Glad to give back what little I can. You've helped me out a lot and I appreciate it. Thanks.

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

Similar Threads

  1. Validate password case sensitive
    By puuts in forum Programming
    Replies: 3
    Last Post: 01-21-2014, 12:12 PM
  2. Password ### login
    By buckwheat in forum Access
    Replies: 5
    Last Post: 09-10-2013, 11:54 AM
  3. When press enter key will log in
    By dododo in forum Forms
    Replies: 1
    Last Post: 07-17-2013, 10:58 PM
  4. Replies: 3
    Last Post: 11-25-2012, 06:09 PM
  5. Replies: 0
    Last Post: 11-22-2011, 09:10 PM

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