Hello,
Can anyone help me by modifying the following code to include StrComp Function to make the ValidPassword sql variable case sensitive?
‘***************************Code Start**************************************************
Private Sub cmdOK_Click()
On Error GoTo Err_Handler
Dim ValidPassword As DAO.Recordset
'Check for valid password.
Set ValidPassword = CurrentDb.OpenRecordset("SELECT * FROM tblLogonPassword WHERE " & _
"UserName='" & Forms![frmLogonPassword]!txtUserName.Value & "' AND " & _
"Password='" & Forms![frmLogonPassword]!txtPassword.Value & "';")
If (ValidPassword.RecordCount = 1) Then
If (ValidPassword!DisableLogon = True) Then
MsgBox "Logon Disabled", vbOKOnly, MsgTitle()
Set ValidPassword = Nothing
Exit Sub
Else
Set ValidPassword = Nothing
DoCmd.Close acForm, "frmLogonPassword"
Exit Sub
End If
End If
Set ValidPassword = Nothing
MsgBox "Invalid Entry." & Chr(13) & Chr(13) & "1) Ensure your User Name is correct." & _
Chr(13) & "2) Ensure your Password is correct.", vbOKOnly, MsgTitle()
DoCmd.GoToControl "txtPassword"
Exit_Handler:
Exit Sub
Err_Handler:
Call LogError(Err.Number, Err.Description, "cmdOK_Click()", , True)
Resume Exit_Handler
End Sub
‘***************************Code End**************************************************
This is the portion of code to modify:
Set ValidPassword = CurrentDb.OpenRecordset("SELECT * FROM tblLogonPassword WHERE " & _
"UserName='" & Forms![frmLogonPassword]!txtUserName.Value & "' AND " & _
"Password='" & Forms![frmLogonPassword]!txtPassword.Value & "';")
I have tried:
Set ValidPassword = CurrentDb.OpenRecordset("SELECT * FROM tblLogonPassword WHERE " & _
"UserName='" & Forms![frmLogonPassword]!txtUserName.Value & "' AND " & _
"([Password], Forms![frmLogonPassword]!txtPassword.Value,0)=0;")
But nothing I do works? Please help.
Can anyone help me by modifying the following code to include StrComp Function to make the ValidPassword sql variable case sensitive?
‘***************************Code Start**************************************************
Private Sub cmdOK_Click()
On Error GoTo Err_Handler
Dim ValidPassword As DAO.Recordset
'Check for valid password.
Set ValidPassword = CurrentDb.OpenRecordset("SELECT * FROM tblLogonPassword WHERE " & _
"UserName='" & Forms![frmLogonPassword]!txtUserName.Value & "' AND " & _
"Password='" & Forms![frmLogonPassword]!txtPassword.Value & "';")
If (ValidPassword.RecordCount = 1) Then
If (ValidPassword!DisableLogon = True) Then
MsgBox "Logon Disabled", vbOKOnly, MsgTitle()
Set ValidPassword = Nothing
Exit Sub
Else
Set ValidPassword = Nothing
DoCmd.Close acForm, "frmLogonPassword"
Exit Sub
End If
End If
Set ValidPassword = Nothing
MsgBox "Invalid Entry." & Chr(13) & Chr(13) & "1) Ensure your User Name is correct." & _
Chr(13) & "2) Ensure your Password is correct.", vbOKOnly, MsgTitle()
DoCmd.GoToControl "txtPassword"
Exit_Handler:
Exit Sub
Err_Handler:
Call LogError(Err.Number, Err.Description, "cmdOK_Click()", , True)
Resume Exit_Handler
End Sub
‘***************************Code End**************************************************
This is the portion of code to modify:
Set ValidPassword = CurrentDb.OpenRecordset("SELECT * FROM tblLogonPassword WHERE " & _
"UserName='" & Forms![frmLogonPassword]!txtUserName.Value & "' AND " & _
"Password='" & Forms![frmLogonPassword]!txtPassword.Value & "';")
I have tried:
Set ValidPassword = CurrentDb.OpenRecordset("SELECT * FROM tblLogonPassword WHERE " & _
"UserName='" & Forms![frmLogonPassword]!txtUserName.Value & "' AND " & _
"([Password], Forms![frmLogonPassword]!txtPassword.Value,0)=0;")
But nothing I do works? Please help.