Hi Karl,
I found a solution for your problem. Even though it is working fine, I am not really convinced by it. There should be an easier way! So if you got any other ideas in the meantime, please let me know.
First I am looping through the users collection to see, what user is the current one.
As this user could be member of more than one group, I am looping through all the his groups plus I used a boolean type variable to check whether one of the groups is the one where you want to hide the command button.
Hope this helps!
Cheers,
Judith
Private Sub Form_Open(Cancel As Integer)
Dim wrkDefault As Workspace
Dim usrLoop As User
Dim grpLoop As Group
Dim bolGroupmember As Boolean
Set wrkDefault = DBEngine.Workspaces(0)
bolGroupmember = False
With wrkDefault
For Each usrLoop In .Users
If usrLoop.Name = CurrentUser Then
For Each grpLoop In usrLoop.Groups
'replace groupname with your groupname
If grpLoop.Name = "grpGroupname" Then
bolGroupmember = True
End If
Next grpLoop
End If
Next usrLoop
If bolGroupmember = True Then
'replace formname and buttonname with your names
Forms!frmFormname!cmdbuttonname.Visible = False
Else
'replace formname and buttonname with your names
Forms!frmFormname!cmdbuttonname.Visible = True
End If
End With
End Sub