hi
you will need to create a "change password" form and an update query in
additon to the table.
the form should have 4 text boxes and a go button.
1 text box for name, 1 for old password, 1 for new password and 1 for new
password again.
here is code i wrote.
Private Sub cmdAccept_Click()
If IsNull(Me!cmboTL2) Then 'this is really a combo box
MsgBox (" Enter a TeamLeader")
Me!cmboTL2.SetFocus
Exit Sub
Else
If IsNull(Me!txtOldPW) Then
MsgBox (" Enter the old Password")
Me!txtOldPW.SetFocus
Exit Sub
Else
If IsNull(Me!txtNewPW) Then
MsgBox (" Enter a new PassWord")
Me!txtNewPW.SetFocus
Exit Sub
Else
If IsNull(Me!txtNewPW2) Then
MsgBox (" Enter the new Password again")
Me!txtNewPW2.SetFocus
Exit Sub
End If
End If
End If
End If
If DLookup("[PTOPW_Password]", "PTOPW", "[PTOPW_Teamleader] = '"
& Me!cmboTL2 & "'") <> Me!txtOldPW Then
MsgBox (" That is not the Old Password. Try again.")
Me!txtOldPW = Null
Me!txtOldPW.SetFocus
Exit Sub
Else
If Me!txtNewPW2 <> Me!txtNewPW Then
MsgBox ("The New Password doesn't match. Try again.")
Me!txtNewPW = Null
Me!txtNewPW.SetFocus
Me!txtNewPW2 = Null
Exit Sub
Else
DoCmd.OpenQuery "qryPTOTLCADR", acViewNormal, acEdit
' this is a standard update query.
MsgBox (" Password Changed")
Dim Msg, Style, Title, Responce
Msg = "Do you wish to change more Passwords?"
Style = vbYesNo + vbQuestion + vbDefaultButton2
Title = "Change more Passwords"
Responce = MsgBox(Msg, Style, Title)
If Responce = vbNo Then
DoCmd.Close acForm, "frmPTOTLCADR"
Exit Sub
Else
If Responce = vbYes Then
Me!txtOldPW = Null
Me!txtNewPW = Null
Me!txtNewPW2 = Null
Me!cmboTL2 = Null
Me!cmboTL2.SetFocus
End If
End If
End If
End If
End Sub
regards
FSt1