• Reports: Passing ‘Order By’ (Access 97, Win 95/98)

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Reports: Passing ‘Order By’ (Access 97, Win 95/98)

    Author
    Topic
    #378570

    Hi all!

    I’m probably having a duh moment, so I’m hoping someone out there can help straighten me out….

    I have a form that builds the “WhereCriteria” of both a form and a report.

    If I want the sort options to pass through to the form, I can use OpenArgs to pass an Order by value.

    If I want the sort options to pass through to the report, what do I do? There is no OpenArgs of the report. I tried including “Order by” in the WhereCriteria statement, but it gives me a syntax error.

    Is the only way around this to create a global variable to pass the information?
    And, for kicks, if this is true, is it fixed in XP? (countdown has started, 5 days until we convert from 97 to XP)

    TIA!

    Cecilia 🙂

    Viewing 0 reply threads
    Author
    Replies
    • #627145

      Reports have no OpenArgs indeed.

      You can set the sort order of the report in the Report_Open event:

      Private Sub Report_Open(Cancel As Integer)
      Me.OrderBy = Forms![frmMyForm].OrderBy
      Me.OrderByOn = True
      End Sub

      where you must replace frmMyForm by the name of the form you use to set the criteria and sort order.

      Note 1: in order to do this, you must *not* specify a sort order in the design of the report (Sorting and Grouping window). A pre-set sorting order will overrule the sorting order you set in code.

      Note 2: I have no idea about XP.

      • #627148

        Thanks Hans. I was hoping there was some other way that I had forgotten, but I guess that’s it. Bummer.

        Ceci 🙂

      • #627261

        Access XP reports have an OpenArgs property, although I haven’t tried to use it.

    Viewing 0 reply threads
    Reply To: Reports: Passing ‘Order By’ (Access 97, Win 95/98)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: