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 question

Status
Not open for further replies.

eussias

Programmer
Sep 25, 2001
97
0
0
AU
What I'm hoping to do is be able to prompt the user of a database, only when it's first opened, for a password. Does anyone know of the easiest way to do this?? :cool:
 
1 Close the database. If the database is shared on a network, ask all other users to close the database.
2 Make a backup copy of the database and store it in a secure place.
3 On the File menu, click Open Database.
4 Select the Exclusive check box, and then open the database.
5 On the Tools menu, point to Security, and then click Set Database Password.
6 In the Password box, type your password. Passwords are case-sensitive.

7 In the Verify box, confirm your password by typing the password again, and then click OK.

The password is now set. The next time you or any other user opens the database, a dialog box will be displayed that requests a password.

Caution

· If you lose or forget your password, it can't be recovered and you won't be able to open your database.
 
This is a real quick example that I hope will get you on track...

1. Create a table <tblUserList> (if one doesn't already exist) of users and passwords.
2. Create a form <frmLogin> to prompt for Name and Password. Add a command button and in the on_click event do the following:

Dim db as Database
Dim rst As Recordset

'Check for valid UserID and Password against User List
Set rst = CurrentDb.OpenRecordset(&quot;tblUserList&quot;, dbOpenDynaset)

rst.FindFirst &quot;[UserName] = &quot; & Me.UserName

If (rst.NoMatch) Then
MsgBox &quot;Please Verify User Name and UserID&quot;, , &quot;Invalid...&quot;
Exit Sub

Else
'Nested If Statement
If rst.UserPassword = me.UserPassword then

'Close this form and open your menu

'Clean up

rst.Close
Set rst = Nothing

Else
MsgBox &quot;Please Verify User Name and UserID&quot;, , &quot;Invalid...&quot;
Exit Sub

End If

End If

3. In your >Tools>Startup menu select frmLogin in the Display Form box

You can add a counter for number of trys and then exit the database after too many. Hope this helps.

meBrian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top