I have a form in Access 2007 that has several locked fields. I would like to have different fields unlocked for different groups of users - depending on their department.
Currently, the fields are unlocked based on user IDs in the Form_Open event. But I'm thinking it would be easier to have code that compares the user's ID to values in a table and locks/unlocks fields accordingly. The coding can get cumbersome, especially when the number of users grow or change.
I am using a module (UserID Module) to reference the user's ID. I also created a table to use in the new code that includes the fields: Name, UserID, and Department.
I'm certain this can be done, but I'm blanking on how.
Thanks in advance for any help.
Here's a sample of my current code:
Currently, the fields are unlocked based on user IDs in the Form_Open event. But I'm thinking it would be easier to have code that compares the user's ID to values in a table and locks/unlocks fields accordingly. The coding can get cumbersome, especially when the number of users grow or change.
I am using a module (UserID Module) to reference the user's ID. I also created a table to use in the new code that includes the fields: Name, UserID, and Department.
I'm certain this can be done, but I'm blanking on how.
Thanks in advance for any help.
Here's a sample of my current code:
Code:
If Me.UserName = "bmor109" Then
Me.Leadership_Contact_Subform.Locked = False
Me.HIBS_Contact_Subform.Locked = False
End If
Comment