M
magmike
I've created a password change form that UPDATEs the record if the old
password entered on the form matches the password in the record.
When it does and a button is clicked, the SQL is run and the standard
"You are about to update 1 row(s)." is displayed.
I would like to eliminate that and put in my own Yes/No MsgBox that
ask the user if they would really like to change their password. How
would I do that in the following code?
Another subquestion: since the If/Then statement determines that the
entered password and the record password matches, it isn't neccesary
in the SQL statement, correct?
Thanks in advance for your help!
magmike
Note: FindRepName is a combo box on the form populates itself with all
of the available reps from the table, and it's bound column is the
record id (repid).
Begin
------------------
Private Sub passchange_Click()
Dim stSQL As String
Dim stPrompt As String
Dim stControl As String
stSQL = "UPDATE Reps SET Reps.reppassword = [newpass] WHERE
(Reps.repid) = [FindRepName];"
stPrompt = "The old password does not match the record. You must know
the old password in order to change it. Please try again."
stControl = "[FindRepName]"
If [oldpass] = [reppassword] Then
DoCmd.RunSQL stSQL
DoCmd.GoToControl stControl
DoCmd.RunCommand acCmdRefresh
Else
MsgBox stPrompt, vbExclamation
End If
End Sub
password entered on the form matches the password in the record.
When it does and a button is clicked, the SQL is run and the standard
"You are about to update 1 row(s)." is displayed.
I would like to eliminate that and put in my own Yes/No MsgBox that
ask the user if they would really like to change their password. How
would I do that in the following code?
Another subquestion: since the If/Then statement determines that the
entered password and the record password matches, it isn't neccesary
in the SQL statement, correct?
Thanks in advance for your help!
magmike
Note: FindRepName is a combo box on the form populates itself with all
of the available reps from the table, and it's bound column is the
record id (repid).
Begin
------------------
Private Sub passchange_Click()
Dim stSQL As String
Dim stPrompt As String
Dim stControl As String
stSQL = "UPDATE Reps SET Reps.reppassword = [newpass] WHERE
(Reps.repid) = [FindRepName];"
stPrompt = "The old password does not match the record. You must know
the old password in order to change it. Please try again."
stControl = "[FindRepName]"
If [oldpass] = [reppassword] Then
DoCmd.RunSQL stSQL
DoCmd.GoToControl stControl
DoCmd.RunCommand acCmdRefresh
Else
MsgBox stPrompt, vbExclamation
End If
End Sub