Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Report error 3265 need input on fix in vba

Status
Not open for further replies.

dkmansion

Technical User
Feb 24, 2005
32
US
Hi,

I have a report which details users in database and a function which pulls the User Group assosciations from Sec.mdw file. the function works great on a single detail. (and only on the currentuser when report is run), and I get error 3265 for EVERY other detail on the report.

Here is the Function:
Code:
'List Groups User is a member of:
   Function faq_ListGroupsOfUser(StrUserIDName As String)
      Dim ws As Workspace
      Dim usr As User
      Dim i As Integer
      Dim strUserGroups As String
      
   Set ws = DBEngine.Workspaces(0)
      [COLOR=black yellow]Set usr = ws.Users(StrUserIDName)[/color]
      For i = 0 To usr.Groups.Count - 1
      If i >= 1 Then
      faq_ListGroupsOfUser = faq_ListGroupsOfUser & ", " & usr.Groups(i).Name
      'Debug.Print usr.Groups(i).Name
      Else
      faq_ListGroupsOfUser = usr.Groups(i).Name
    End If
      Next i
      'Debug.Print strUserGroups
    End Function

I am passing the variable as:
Code:
=faq_ListGroupsOfUser([txtClerkLogin])
in the conrtolsource of the report control displaying the data.

Any help would be appreciated.

Donald M
 
Donald M
I see in an Errors table that Error 3265 is "Object is not in this Collection."

I also note that Help indicates the syntax for ws.Users() is ws.Users("User")

Does that suggest that there should be parentheses around StrUserIDName?

These are only suggestions.

Tom
 
Tom,

True I get the error with the description in a msgbox. I have been unable to determine why I get an #Error in the report control for every record except the user that is currently logged in to the DB.
Also:
I replaced the "User" with the passed variable string: strUserIDName, which is the User's login name in the security file.

I will try a few more things and post my findings. Maybe someone else comes by with a suggestion. Thanks.



Donald M
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top