Results 1 to 3 of 3
  1. #1
    panoss is offline Advanced Beginner
    Windows 7 32bit Access 2003
    Join Date
    Oct 2014
    Posts
    59

    Password field with input checking?


    I 've made a password field with Input Mask 'Password'.
    But I want to be allowed the input of only letters and numbers.
    How can I add this feature?

  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,913
    With VBA code that checks each character in the password string.
    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
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    This has worked for me, where TargetField is the actual name of the Textbox. I just tested it and it works with the Password Input Mask in use:
    Code:
    Private Sub TargetField_KeyDown(KeyCode As Integer, Shift As Integer)
    
      Select Case KeyCode
       
       Case 48, 49, 50, 51, 52, 53, 54, 55, 56, 57
       Case 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80
       Case 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 96, 97, 98, 99, 100, 101
       Case 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114
       Case 115, 116, 117, 118, 119, 120, 121, 122
    
       Case vbKeyDelete, vbKeyBack, vbKeyReturn, vbKeyRight, vbKeyLeft, vbKeySpace, vbKeyEscape
    
       Case vbKeyHome, vbKeyEnd, vbKeyTab
    
        KeyCode = KeyCode
    
       Case 16 'Prevents use of ! @ # $ % ^ & * ( ) _ +
       
        MsgBox "<Shift Key> Use Is Not Allowed!"
        
        KeyCode = 0
        
       Case Else
        
        KeyCode = 0
      
      End Select
    
    End Sub

    The only caveat is that as written, it does not allow capital Alpha characters to be entered; I've simply never found the need for that level of security in an Access database.

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

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

Similar Threads

  1. Replies: 5
    Last Post: 09-25-2014, 08:33 PM
  2. Checking Password
    By Always_Learning in forum Programming
    Replies: 5
    Last Post: 09-11-2014, 09:05 PM
  3. Web Database: Input Mask for Password
    By besuchanko in forum Forms
    Replies: 3
    Last Post: 07-25-2013, 03:28 PM
  4. Error checking field, SetFocus does not work
    By SemiAuto40 in forum Access
    Replies: 9
    Last Post: 07-26-2011, 10:08 AM
  5. Checking user input is valid
    By AccessPoint in forum Access
    Replies: 4
    Last Post: 07-18-2010, 06:43 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