i write the userID to the form (locked) at form load:
txtUserID= Environ("Username")
txtRights = getUserLevel(txtUserID)
then all queries can use the txtRights box to pull data
Code:
Public Function getUserLevel(pvUserID ) As String
getUserLevel= Dlookup("[Level],"tUsers","[UserID]='" & pvUserID & "'") & ""
End Function
then certain rights can open certain queries:
Code:
sub btnOpenQry_click()
select case true
case txtRights = "M" , txtRights = "A"
docmd.openquery "qsAdminQry"
case else
msgbox "You don't have rights for this"
end select
end sub
or put the rights code into the query:
select * from table where forms!fMyForm!txtRights = 'A'