is it possible in MS Access 2010 to restrict the records a user can see in a dataview form? For example User A should only see records from department A, whereas User B should only see records from department B.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Create a query which uses your business rule as a constraint to return only the subset of rows the user should be allowed to access. Then build your form with that query as its record source.
That approach depends on 2 conditions:
WHEREclause.You can use an API method to get the Windows account name of the current user. See an example at Get Login name. If your db file is MDB format, you could set up ULS (user level security), and get the Access user name with the
CurrentUser()function. ULS is not supported in the newer ACCDB format, but Access 2010 can still use MDB format db files.Either of those approaches could satisfy the first condition. You could also develop code to manage custom user accounts, but that seems like too much extra work to me.
Something like this could implement your business rule as a query
WHEREclause. It uses thefOSUserName()function from the link above.However, a less brittle approach would be to inner join a table which contains the user names matched with the department(s) they should be allowed to view.