Hi,
How do I code a form so that when a User with a security Level 2 (level set by me in tblUsers) only can see info regarding his store, but when a User with a security Level 3, which is a Manager can see info for all stores?
Here is the code for the first part of the question, don't know how to do it for the managers thou?
Thanks,
How do I code a form so that when a User with a security Level 2 (level set by me in tblUsers) only can see info regarding his store, but when a User with a security Level 3, which is a Manager can see info for all stores?
Here is the code for the first part of the question, don't know how to do it for the managers thou?
Code:
Private Sub Form_Load()
Dim lngUserDpto As Byte
Dim lngAnoFisD As Long
Dim lngAnoFisH As Long
SetTitle (Me.Name)
'DLookup("User", "tblCurrentUser")
LocalUser = DLookup("User", "tblCurrentUser")
strLocalUserSecurityLevel = DLookup("SecurityLevel", "tblCurrentUser")
lngUserDpto = DLookup("Depnum", "tblUsers", "User =" & LocalUser)
lngAnoFisD = DLookup("AnoFiscalD", "tblCurrentUser", "User =" & LocalUser)
lngAnoFisH = DLookup("AnoFiscalH", "tblCurrentUser", "User =" & LocalUser)
Me.UserName = CLng(LocalUser)
'Intantiate recordset object
Set objRec = New ADODB.Recordset
Me.Filter = "Depnum=" & CByte(lngUserDpto) & "And AnoD=" & lngAnoFisD & "And AnoH=" & lngAnoFisH
Me.FilterOn = True
End Sub
Thanks,