Hello,
I am having an issue with some vba for a change password screen. Below, my Employee ID is a text field and it keeps producing the following error:
The expression you entered as a query parameter produced this error: 'Steve'
The error pops a msgbox, and doesn't highlight any vba. I outlined in the red where I think the source of the problem is. The particular table does not have autonumber field, only text fields.
Any recommendations?
I am having an issue with some vba for a change password screen. Below, my Employee ID is a text field and it keeps producing the following error:
The expression you entered as a query parameter produced this error: 'Steve'
The error pops a msgbox, and doesn't highlight any vba. I outlined in the red where I think the source of the problem is. The particular table does not have autonumber field, only text fields.
Any recommendations?
Code:
Private Sub Command6_Click()
On Error GoTo Err_Command6_Click
Dim intUserID As String
Dim strOldPassword As String
Dim strSQL As String
intUserID = Me.List0
[COLOR=red]strOldPassword = DLookup("[Password]", "Personnel", "[Employee ID]=" & intUserID)[/COLOR]
Select Case strOldPassword
Case Is = Me.Text2
[COLOR=red]strSQL = "UPDATE Personnel SET Password=" & "'" & Me.Text4 & "' WHERE [Employee ID]=" & Me.List0[/COLOR]
DoCmd.SetWarnings False
DoCmd.RunSQL strSQL
DoCmd.SetWarnings True
MsgBox "Password has been changed", vbInformation, "Password Changed"
Case Is <> Me.Text2
MsgBox "The Old Password does not match", vbInformation, "Type Correct Old Password"
End Select
Me.Text2 = ""
Me.Text4 = ""
Me.List0.Requery
Me.Text2.SetFocus
Exit_Command6_Click:
Exit Sub
Err_Command6_Click:
MsgBox Err.Description
Resume Exit_Command6_Click
End Sub