Thanks for that bob, this is the answer. I have used this code to find out what groups the current user is in, then appended those group names to a table which is linked to a menu structure table, in other words depending what groups a user belongs to they will see different menu items in a combo box list based on the menu table. This avoids them logging in with different user name aliases to see different menu options.
Code follows below:
Public Function GroupX()
Dim wrkDefault As Workspace
Dim usrLoop As User
Dim grpLoop As Group
Dim dbs As Database
Dim rstMenuPermissions As Recordset
'Initialise workspace, database and recordset
Set wrkDefault = DBEngine.Workspaces(0)
Set dbs = CurrentDb
Set rstMenuPermissions = dbs.OpenRecordset("tblMenuPermissions", dbOpenTable)
'Working with the default workspace...
With wrkDefault
'Find Current username object in the default Workspace 's Users collection.
For Each usrLoop In .Users
If usrLoop.Name = CurrentUser() Then
'Enumerate all Group objects in each the CurrentUser's Groups collection.
If usrLoop.Groups.Count <> 0 Then
For Each grpLoop In UsrLoop.Groups
'Append the group name to groups table
With rstMenuPermissions
.AddNew ' Add new record.
!MG_GroupName = grpLoop.Name ' Add data.
.Update ' Save changes.
End With
Next grpLoop
End If
End If
Next usrLoop
'Finish working with workspace
End With
' Close recordset to free memory.
rstMenuPermissions.Close
' Free memory used by object variable.
Set dbs = Nothing
End Function
[This message has been edited by helena (edited 12-04-2000).]