mvdwal
asked on
Multiple active directory groups access to ms access form
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(s trGroupWit hAccess)
If Cancel = True Then
MsgBox "You have no access to this form.", vbExclamation
End If
End Sub
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!
Kind regards,
Michiel
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(s
If Cancel = True Then
MsgBox "You have no access to this form.", vbExclamation
End If
End Sub
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!
Kind regards,
Michiel
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Dear Peter,
Thanks a lot! It works!!!
I was spending hours on this form...
I did not check the other solution. But also many thanks for helping me out on this.
Do you have any tips to understand vb better? Maybe a good book? I wanna learn this!
Kind regards,
Michiel
Thanks a lot! It works!!!
I was spending hours on this form...
I did not check the other solution. But also many thanks for helping me out on this.
Do you have any tips to understand vb better? Maybe a good book? I wanna learn this!
Kind regards,
Michiel
Cancel = Not IsMemberOfSecurityGroups(s
If that doesn't work, you can always do this:
Cancel = Not IsMemberOfSecurityGroups(s
If Not Cancel Then
Cancel = Not IsMemberOfSecurityGroups(Y
End If