Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

list groups user error

Discussion in 'Information Technology' started by segurarl, Jul 28, 2006.

  1. segurarl

    segurarl
    Expand Collapse
    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!!!
     
  2. Loading...

    Similar Threads Forum Date
    Request#3 - Introduce SPN to a Mailing Lists/Social Networking Groups Get Involved Jan 20, 2009
    Sikh News How The Left & Indian Nationalists Distorted The History Of Sikh Gadhar Movement - Breaking News Sep 21, 2016
    Interfaith Materialists And Its Discontents Interfaith Dialogues Jun 10, 2016
    Sikhi Quasi-Pragmatists And Quasi-Spiritualists, Care To Explain? Sikh Sikhi Sikhism Jun 6, 2016
    Cholesterol Is Finally Officially Removed From "naughty List" Health & Nutrition Feb 11, 2016

  3. Joan Wild

    Joan Wild
    Expand Collapse
    Guest

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

    --
    Joan Wild
    Microsoft Access MVP

    segurarl wrote:
    > 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!!!
     
  4. segurarl

    segurarl
    Expand Collapse
    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!!!

    "Joan Wild" wrote:

    > When you call the function are you supplying a username?
    > faq_listGroupsOfUser("segurarl")
    >
    > --
    > Joan Wild
    > Microsoft Access MVP
    >
    > segurarl wrote:
    > > 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!!!

    >
    >
    >
     
  5. segurarl

    segurarl
    Expand Collapse
    Guest

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

    Thank you very mucho for your help!

    Have a great day!!!

    "Joan Wild" wrote:

    > When you call the function are you supplying a username?
    > faq_listGroupsOfUser("segurarl")
    >
    > --
    > Joan Wild
    > Microsoft Access MVP
    >
    > segurarl wrote:
    > > 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!!!

    >
    >
    >
     
  6. Joan Wild

    Joan Wild
    Expand Collapse
    Guest

    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)


    --
    Joan Wild
    Microsoft Access MVP

    segurarl wrote:
    > 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!!!
    >
    > "Joan Wild" wrote:
    >
    >> When you call the function are you supplying a username?
    >> faq_listGroupsOfUser("segurarl")
    >>
    >> --
    >> Joan Wild
    >> Microsoft Access MVP
    >>
    >> segurarl wrote:
    >>> 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!!!
     

Share This Page