Results 1 to 12 of 12
  1. #1
    flippedbeyond is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2011
    Posts
    7

    How to set openargs of sub report?

    I am trying to set the OpenArgs of a SubReport that is in another report.

    Here's what i've tried in the report that contains the subreport:

    Code:
    Private Sub Report_Open(Cancel As Integer)
        subGetStudentInfoById.Report.OpenArgs = "1"
    End Sub
    gives me runtime error '2455', "You entered an expression that has an invalid reference to the property form/report."



    I'm assuming OpenArgs is a readonly property? or something with the subreport? Please help, Thanks in advance

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,642
    To the best of my knowledge, you can't set the value like that, only with OpenForm/OpenReport. Help seems to concur:

    [Setting] this property is available only by using a macro or by using Visual Basic with the OpenForm method of the DoCmd object.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    flippedbeyond is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2011
    Posts
    7
    oo, okay. I'll have to come up with a work around then.

    Thanks for the fast reply.

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,642
    No problem. Not sure what you're doing, but one workaround may be setting the main report's OpenArgs, and reading that from the subreport. You can put more than one value there and parse them back out if you're already using it.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    flippedbeyond is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2011
    Posts
    7
    Quote Originally Posted by pbaldy View Post
    one workaround may be setting the main report's OpenArgs, and reading that from the subreport
    to clarify, does that mean from the subreport i can find out if it has a parent? then get the openargs of the parent report?

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,642
    Yes; untested, but I think this would get the parent's OpenArgs:

    Me.Parent.OpenArgs
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  7. #7
    flippedbeyond is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2011
    Posts
    7
    Sweet, yea it works. This works perfectly for me. Thanks alot.

  8. #8
    flippedbeyond is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2011
    Posts
    7
    Hey, i hope this isn't a problem, this is kinda off topic, but you mentioned a delimited string, i used the split function to get the array, but how do i get the count of how many elements are in an array? sorry kinda new to vba...

  9. #9
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,642
    Check out UBound() in VBA help (don't forget the array starts at 0).
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  10. #10
    flippedbeyond is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2011
    Posts
    7
    k, Thanks alot.

  11. #11
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,642
    No problem, and welcome to the site by the way!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  12. #12
    flippedbeyond is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2011
    Posts
    7
    thanks (appears i can't enter a message when it's under 10 characters or something lol)

Please reply to this thread with any new information or opinions.

Similar Threads

  1. OpenArgs Problem: Error 438
    By SwaziMan in forum Programming
    Replies: 2
    Last Post: 08-05-2011, 12:20 PM
  2. OpenArgs problems - FAO pbaldy/ruralguy
    By l3111 in forum Forms
    Replies: 22
    Last Post: 06-06-2011, 08:46 AM
  3. Open a second form using the OpenArgs
    By blueraincoat in forum Forms
    Replies: 6
    Last Post: 06-02-2011, 06:19 AM
  4. Showing OpenArgs in a Report.
    By SIGMA248 in forum Programming
    Replies: 2
    Last Post: 04-01-2011, 11:57 AM
  5. Opening a form with openargs and things
    By mwabbe in forum Forms
    Replies: 5
    Last Post: 09-29-2010, 11:01 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums