wrightyrx7
Registered User.
- Local time
- Today, 03:11
- Joined
- Sep 4, 2014
- Messages
- 104
Hi all,
I have found some code online and trying to adapt it to suit my needs.
The part its failing at is marked in red.
I get error message:
Run-time error '2465':
Microsoft Access can't find the field '|1' referred to in your expression.
I have found some code online and trying to adapt it to suit my needs.
The part its failing at is marked in red.
I get error message:
Run-time error '2465':
Microsoft Access can't find the field '|1' referred to in your expression.
Code:
Option Compare Database
Option Explicit
Private Sub Command1_Click()
Dim pUser As Long
'Check to see if data is entered into the UserName combo box
If IsNull(Me.txtCurrent) Or Me.txtCurrent = "" Then
MsgBox "You must enter a your current password.", vbOKOnly, "Required Data"
Me.txtCurrent.SetFocus
Exit Sub
End If
'Check to see if data is entered into the password box
If IsNull(Me.txtNew) Or Me.txtNew = "" Then
MsgBox "You must enter a New Password.", vbOKOnly, "Required Data"
Me.txtNew.SetFocus
Exit Sub
End If
'Check value of password in tblUsers to see if this
'matches value chosen in combo box
pUser = DLookup("[ID]", "Users Extended", "Username='" & cUser & "'")
If Me.txtCurrent.Value = DLookup("Password", "Users", "ID=" & pUser) Then
'Check new and confim passwords are the same
If Me.txtNew.Value = Me.txtConfirm.Value Then
'Changes password on tblUsers and Close form
[COLOR="Red"][Password] = Me.txtNew.Value[/COLOR]
DoCmd.Close acForm, "Change Password", acSaveNo
DoCmd.OpenForm "Call Log"
MsgBox "Password Changed"
Else
MsgBox "Passwords Do not match. Please Try Again", vbOKOnly, _
"Invalid Entry!"
Me.txtConfirm.SetFocus
End If
Else
MsgBox "Incorrect Password"
Exit Sub
End If
End Sub
Last edited: