Results 1 to 5 of 5
  1. #1
    AmanKaur123 is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jan 2017
    Posts
    47

    Compare two passwords

    Hi All



    I am building a form to generate unique passkey for each user. So there are 2 textboxes named
    1. Create a Password
    2. Confirm your Password

    Now I want to check if both the passwords are same. If I write the following code, It always shows "Doesn't match"

    Code:
    Dim rs As Recordset
    Set rs = CurrentDb.OpenRecordset("tbl_RMS_PassKey")
    If StrComp(txtPass, txtConfirmPass, vbBinaryCompare) = 0 Then
    MsgBox "Match occurred"
    else
    msgbox "Match doesn't occur"
    end if
    If I change the above line code with the following then it still shows "doesn't match"
    Code:
    if txtpass=txtConfirmpass then
    ANy help will be much appreciated.

    Thanks

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,522
    your code ,StrComp(txtPass, txtConfirmPass, vbBinaryCompare) = zero, means false.
    if false then
    match
    else
    match doesnt occur
    endif

    since it IS true, then 'match doesnt occur'.
    make it
    IF StrComp(txtPass, txtConfirmPass, vbBinaryCompare) THEN

  3. #3
    AmanKaur123 is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jan 2017
    Posts
    47
    sorry it worked fine. I didn't make any change but it worked. I had to transfer the setfocus to a different control.

  4. #4
    AmanKaur123 is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jan 2017
    Posts
    47
    Also any idea for the passwords that users can type? Any validations on the passwords? Any suggestions are welcome. Thanks

  5. #5
    kagoodwin13 is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Feb 2012
    Posts
    181
    Quote Originally Posted by AmanKaur123 View Post
    Also any idea for the passwords that users can type? Any validations on the passwords? Any suggestions are welcome. Thanks
    My suggestion would be to search other people's threads for ideas on how to create good user security within Access. Access does not come pre-built with any security features.

    There are some validation rules that would be simple. For example, to validate a password is at least 8 characters, VBA can be used:

    Code:
    If Len(txtPassword) < 8 Then 
    Call MsgBox "Your password is not long enough."
    Else
    Call MsgBox "Password is long enough."
    End If
    Other validation rules, such as at least one Upper case and one lower case and one number are included, would require more complex VBA. See more here: http://www.excelforum.com/excel-prog...ion-print.html

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

Similar Threads

  1. Replies: 9
    Last Post: 11-11-2015, 01:55 PM
  2. Passwords visible on web forms?
    By bgarey in forum Access
    Replies: 1
    Last Post: 10-17-2013, 07:33 AM
  3. Different passwords on front-end & back-end?
    By Delta223 in forum Access
    Replies: 3
    Last Post: 01-07-2011, 09:25 AM
  4. encrypting passwords in a SQL statement using c++
    By princess-1 in forum Security
    Replies: 5
    Last Post: 10-21-2010, 11:51 AM
  5. Setting up User names and passwords
    By knightjp in forum Security
    Replies: 2
    Last Post: 02-05-2009, 10:18 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