Results 1 to 3 of 3
  1. #1
    funkygoorilla is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2011
    Posts
    93

    Compare two fields

    Hi,


    I have two fields that I am using as a means of password verification for users who would like to change their passwords in my DB. I need to know if it is possible to have the two fields check for case sensitivity? Currently, if you put arizona in field A, and Arizona in field B, then Access will accept it and over write their current password. Below is my Save button On CLick Event. I obtained this with the help of a member name June7. Any info or tips would be greatly appreciated.

    Code:
    Private Sub btnSave_Click()
    If Me.pwFirst = Me.pwSecond And Len(Me.pwFirst) & "" > 0 Then
        DoCmd.RunCommand acCmdSaveRecord
        DoCmd.Close acForm "frmChangePasswordtest"
        DoCmd.OpenForm "frmMainMenu"
    Else
        MsgBox "New Password entries do not match. Re-enter ." _
            & vbCrLf & "and please try again.", vbCritical, _
            "Re-enter both Passwords."
    End If
    End Sub

  2. #2
    pdebaets is offline Competent Performer
    Windows Vista Access 2010 (version 14.0)
    Join Date
    Jul 2010
    Location
    Los Angeles
    Posts
    235
    Try this:

    If strcomp("" & Me.pwFirst, "" & Me.pwSecond, vbBinaryCompare) = 0 And Len(Me.pwFirst & "") > 0 Then

  3. #3
    funkygoorilla is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2011
    Posts
    93
    Hi, thanks for the code. That works as I would like it. The only thing is that even if the two "password" dont match, when you click the save button, the second password gets saved into the table. Is there a way to have it save only if the two are equal?

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

Similar Threads

  1. SELECT WHERE compare two fields
    By bulb763 in forum Access
    Replies: 5
    Last Post: 03-22-2011, 09:56 AM
  2. Replies: 7
    Last Post: 12-03-2010, 11:09 AM
  3. Help with if statement to compare multiple fields
    By usmcgrunt in forum Programming
    Replies: 2
    Last Post: 12-01-2010, 06:43 PM
  4. Using IIF to compare two fields data
    By psych in forum Access
    Replies: 2
    Last Post: 03-10-2010, 10:11 AM
  5. Compare two fields!
    By finditsol in forum Forms
    Replies: 1
    Last Post: 02-11-2010, 01: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