I have the following code working in my ms access form (ms access 2007) with active directory users. Members in the purchase group have access.
But I need to know a code where multiple groups have access to this form. So if you are member of Sec-Purchase or Sec-Management.
Who knows how I can do this?
Here's my code:
Private Sub Form_Open(Cancel As Integer)
Dim strGroupWithAccess As String
'Set the name of the group with access to this form.
strGroupWithAccess = "Sec-Purchase"
'Test if the user has access. If not, set Cancel to True and the form will not open.
Cancel = Not IsMemberOfSecurityGroups(strGroupWithAccess)
If Cancel = True Then
MsgBox "You have no access to this form.", vbExclamation
It's driving me crazy! I've tried a lot of options but my vb knowledge is limited...
Thanks a lot for helping me out!