Hi , It is working and I pasted the code. Please check whether it is good or not so that i should not have any problems in the future. Thanks A lot to VBAiNet , SOS, Ghudson
Dim UserName As String
Dim curgroup As String
Dim GroupNames(10) As String
Dim ws As Workspace
Dim usr As User
Dim i As Integer
Dim j As Integer
Dim filter As String
UserName = CurrentUser
Set ws = DBEngine.Workspaces(0)
Set usr = ws.Users(UserName)
'Put all groups user is in into an array
For i = 0 To usr.Groups.Count - 1
GroupNames(i) = usr.Groups(i).Name
Next i
'Loop though groups until you get a match and set the curdept variable
For i = LBound(GroupNames) To UBound(GroupNames)
MsgBox ("Group: " & GroupNames(i))
Select Case GroupNames(i)
Case "Admins"
For j = 1 To CommandBars.Count
CommandBars(j).Enabled = True
Next j
Exit Sub
Case "Users"
For j = 1 To CommandBars.Count
CommandBars(j).Enabled = False
Next j
Exit Sub
End Select
Next i