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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Password a form

Status
Not open for further replies.

AccessXP

IS-IT--Management
Jan 29, 2002
132
I wanted to know if there is a way to password a form when the form button is pressed.

Example....
On the menu form there is a button for sales. When that button is pressed, open a password box promting user for password before entering that form.

Thanks.
 
There are many ways you could do this, this is the easiest and quickest (although, not the prettiest).

Lets say you create a table called UsysPassword with a single field called password.

* Note - The reason to name it with a Usys prefix is that Access will see the table as a "User System" table, and the only way it can be seen is to go to Tools | Options and select System Objects. It is just one way to hide the table from users.

Now on the OnClick of the button put the following code:

==========
Private Sub cmdSales_Click()
Dim PWD As String
PWD = DLookup("password", "UsysPassword ")

If PWD <> InputBox(&quot;Enter Password&quot;) Then
MsgBox &quot;You have entered the wrong password, try again&quot;
Else
Do whatever here ....
End If
End Sub
==========
Jim Lunde
compugeeks@hotmail.com
We all agree your theory is crazy, but is it crazy enough?
 
Thanks I will Give it a try.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top