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!

Setting Passwords on Forms to Limit User Acces 1

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Hi

Is there anyway to prompt Users for a username and password when opening a form. I need to secure my database so that only certain people can access the forms they require to aviod data being amended that shouldn't be.

Any ideas?

Jo
 
To be honest your best solution here would be to get the user to log in, ie have a prompt on opening the database.

On logging in they are then given a particular user access (maybe a key), so on opening each form, you can have a load/current check on what key that user has and dependant on that is whether they can view/change certains criteria.

You will need to make the key variable a global/pulic one in order for it to be used throughout the database.

I am probably going a bit beyond what you really want though.

Sorry if I am :)

- F8i
Programmer
e: f8i@f8i.co.uk
 
Hi!

To expand a little on the previous suggestion, you may want to set up a hidden table with the each of the users LAN name and their 'Security Level'. Then you can do several things such as, in the Form_Open event:

Dim rst As DAO.Recordset
Dim strCriteria as String

strCriteria = "Select fldSecurityLevel From tblSecurity Where fldUser = '" & CurrentUser & "'"
Set rst = CurrentDb.OpenRecordset(strCriteria, dbSnapshot)

If rst.EOF = True and rst.BOF = True Then
Cancel = -1
ElseIf rst!fldSecurityLevel <= 2 Then
Cancel = -1
End If

Set rst = Nothing

Now the form won't open if the user isn't in your table or if their security level is less than 3. Instead you could use the security level to lock certain text boxes or hide command buttons using the Form_Load event. The possibilities are enormous.

hth
Jeff Bridgham
 
Much more extended on my suggestion, and much more secure (in a sense).

Thanks for that Jeff, I might use that at some point.

- F8i
Programmer
e: f8i@f8i.co.uk
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top