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!

How do I get a user to only see there sections records

Login security

How do I get a user to only see there sections records

by  assets  Posted    (Edited  )
Trying to add security level to a database. without workgroups. With this method users can only see data that applies to them.

Create a form with 2 textboxes for the login form. The first textbox is to enter user that is logging on. (There is faq that tell how to capture the network Logon if you wish not to enter the login name in the text box). The user would need to enter the password in the second textbox (use the password input mask for password only asterisks) The code below loks up the table to find the user name password and section the user is from.
Pass = DLookup("[Password]", "employees", "[login]='" & Me.Text1 & "'")
DivisionIDfilter = DLookup("[DivisionID]", "employees", "[login]='" & Me.Text1 & "'")

You need to store the user name and password in a table eg employees. Having passwords in the table is not a concern for security as it is only going to be used to filter records, it is not meant as high level security.. If a section has 50 staff, they only need to see information on computers etc, and employees details for those 50 staff and not the 800 other staff. If a password is stored in a table and the database window is only accessible by hidden button then the administrator does not have administrator permission to the database object. You will also need to disable the shift key for startup. There is a faq on disabling the shift key see the web site www.robotparade.co.uk . This site had a file called lock&unlock, that had a database that can lock and unlock the shift key (it is in 97 format but can convert to 2002).

You will need to filter all form and reports to only let user see data that applies to there section using the code below
If filterOFF = True Then
Exit Sub
Else
Me.Form.Filter = "DivisionID=" & DivisionIDfilter
Me.FilterOn = True
End If
If DivisionIDfilter = 0 Then
Me.FilterOn = False
End If
End Sub

I hope this is a starting point for you database.

Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top