list groups user error

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm using the Security Faq code:
Function faq_ListGroupsOfUser (strUserName As String)
Dim ws As WorkSpace
Dim usr As User
Dim i As Integer

Set ws = DBEngine.Workspaces(0)
Set usr = ws.Users(strUserName)
For i = 0 To usr.Groups.count - 1
Debug.Print usr.Groups(i).Name
Next i
End Function

I'm getting the following error when running the code:

"The expression you entered has a function containing the wrong number of
arguments"

Thank you for you help!!!
 
When you call the function are you supplying a username?
faq_listGroupsOfUser("segurarl")
 
No. I'm not.

How can I get Access to get the current user name and replace "strUserName"
with that info?

The menu will change based on the "user name" group.

Thanks a lot!!!
 
I'm adding CurrentUser() when calling the function and it is working.

Thank you very mucho for your help!

Have a great day!!!
 
faq_listGrupsOfUser(CurrentUser())

However you may want to use the faq_IsUserInGroup() function instead, given
what you are trying to do (change the menu based on group membership)
 
Back
Top