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

Adding a password? 1

Status
Not open for further replies.

PollaksTJ

Technical User
Apr 14, 2003
1
US
I need a form that has a text box on it, that asks the user for a password. If the user gets it right it should go to the next form. If the user gets it wrong, it should tell them incorrect password and give them another chance. After 3 incorrect try's the program should quit?

Any help is appreciated.

Thanx
 
Just open a new form in the design view and put a text box in it. Then add a cmd button with a "Continue" or something like that. The 'onclick' of the cmd button could either have the acceptable password or you can go somewhere else to find it - say a table. This is not very secure but will work - especially if you compile with an mde.

Rollie E
 
Pollaks

Here's what I did. I created a table called tblPassword, with 3 fields [UserID#](autonum), [User] (text), and [PW] (text). Also, [PW]'s iinput mask is set to PASSWORD.

Then, there's a form for the user to enter his ID and PW. The form is based on tblPassword. They select their name from a dropdown box, and enter their passord in another field. They click OK when they're done. The OK button's on click property is set to a function that verifies if the ID/PW combination is in that table. If so, the user gets to the menu. If not, he gets an error message.

I don't count the number of attempts.

Hope this helps.

Jim

"Get it right the first time, that's the main thing..." [wavey]
 
Of course, there's nothing to stop a user from getting around this system, as described. Is there a reason you don't want to use Access' built-in security? That way, you can allow users to open only those forms they need.

Using Access security is way more secure, plus, your users won't have to type in any more passwords after they open the database.



 
if you don't really need security from people who know how get around it....Just add a simple pop up box on your main menu or whatever form you want password protected.

add this for the Private sub on the ONLOAD proceedure of the form you wish to protect. Elvis is the password i used here.


Dim strinput As String

strinput = InputBox("Please enter password")

If strinput = ("elvis") Then
DoCmd.OpenForm "fm_mainmenu", acNormal
Else
MsgBox "Wrong password!"
DoCmd.Quit

End If

This one quits after one wrong password.
:)
hope this helps some
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top