Form Password

G

Gus

From the Main Switchboard, I want to open a from with Passwords for several
associates. I know this is not he most secure way to go about it but security
in this from is not as important. I know I need to create a table for storing
passwords but can someone take me by the hand in completing this process.
When it comes with working with codes, I am lost...
Any help will be appreciated...
Gus
 
F

FSt1

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
 
S

Steve Schapel

Gus,

On your form, put two unbound controls, one for the user name, and the
other for the password. The password control will no doubt be a
textbox, but for the user name you may want to use a combobox which
lists the possible users. You may want to have a Command Button that
the user will click after they have entered the name and password, or
you may want the password hecked on the After Update event of the
password textbox. Either way, you can use code similar to the following...
If Me.Password = DLookup("[Password]","YourPasswordsTable","[User]='"
& Me.User & "'") Then
DoCmd.OpenForm "TheForm"
Else
MsgBox "Invalid password"
End If
 
Top