So what would your example look like in the table and in the code?
I used the standard switchboard form and added the user level to the switchboard table
User level in tblUsers
I could probably make it a little easier now, as I know a fair bit more about Access, but it would also deter anyone trying to fathom how it worked.
I had to go back and look at the code it has been so long.
On login I set TempVars so I had the pertinent information to hand all the time
TempVars("EmployeeID").Value = Me.cboEmployeeID.Column(0)
TempVars("Employee").Value = Me.cboEmployeeID.Column(1)
TempVars("UserLevel").Value = DLookup("DataOrder", "tblLookup", "LookupID = " & Me.cboEmployeeID.Column(3))
DoCmd.OpenForm "Switchboard"
Source for cboEmployeeID is
Code:
SELECT tblUser.EmployeeID, [Forename] & " " & [Surname] AS FullName, tblUser.UserPassword, tblUser.UserLevel, tblUser.UserActive
FROM tblEmployee INNER JOIN tblUser ON tblEmployee.EmployeeID = tblUser.EmployeeID
WHERE (((tblUser.UserActive)=True));
The the switchboard form recorsource was
Code:
SELECT *
FROM [Switchboard Items]
WHERE ((([Switchboard Items].ItemNumber)>0) AND (([Switchboard Items].SwitchboardID)=[TempVars]![SwitchboardID]) AND (([Switchboard Items].UserLevel)>=[Tempvars]![UserLevel]))
ORDER BY [Switchboard Items].ItemNumber;
So I never presented anything to anyone who should not see it.
I only supplied an accde so they could not see any forms/tables etc.
I was lucky that I did not have any colleagues who would go looking on how to break it.