list groups user error

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!!!
 
J

Joan Wild

When you call the function are you supplying a username?
faq_listGroupsOfUser("segurarl")
 
G

Guest

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!!!
 
G

Guest

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

Thank you very mucho for your help!

Have a great day!!!
 
J

Joan Wild

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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top