Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PASSWORD protect

Status
Not open for further replies.

Mudshark

Programmer
Sep 26, 2000
11
0
0
US
What is the best way to password protect a form for editing? In other words - the user comes into a form read-only - hits a button - is asked for a password - if the password is correct -they now have read/write access until they leave the form.

thanks for your help

>matt
 
When you say password protect, do you mean the data is safe, or to modify the form design??

also, what vertion of access are you using?

--James
junior1544@jmjpc.net
Life is change. To deny change is to deny life.
 
Thanks for replying so quickly...
Access 2000

Want to protect the data not the form layout.
 
Did you want any person to have their own password, or just one password that you set??

It'll be much easier to have one password that you set...

also, if every one will have their own password, what kind of tracking (if any) do you want?? (i don't realy have info on tracking changes... never did it.)

--James
junior1544@jmjpc.net
Life is change. To deny change is to deny life.
 
One solution is to create an on_open event to set the form's properties as follows:

Private Sub Form_Open(Cancel As Integer)
Form.AllowAdditions = False
Form.AllowEdits = False
Form.AllowDeletions = False
cmdButton.Caption = "Unlock" ' see below for info on cmdButton
End Sub

Then create a command button that has a caption of "Unlock" and run the following code on click:

Private Sub cmdButton_Click

If cmdButton.caption = "Unlock" Then

if Inputbox("Please enter the password to _ unlock", "Password Required") = "password" Then

Form.AllowAdditions = True
Form.AllowEdits = True
Form.AllowDeletions = True
cmdButton.Caption = "Lock"
Else
Msgbox "Incorrect password entered"
End if
else
Form.AllowAdditions = False
Form.AllowEdits = False
Form.AllowDeletions = False
cmdButton.Caption = "UnLock"
End If

End Sub


See how you get on...

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top