Results 1 to 8 of 8

Thread: Report Sorting

  1. #1
    Join Date
    Nov 2002
    Location
    Oakland, CA
    Posts
    126

    Unanswered: Report Sorting

    I wonder whether there is a way to have the user decide what he want the report to be sorted by. I have a report based on a query with 5 fields. I have a default sorting but would like the user to decide what he wants the report sorted by without him Analyzing it in Excel and then sort it. Thank you

  2. #2
    Join Date
    Apr 2004
    Posts
    173
    check this link

    http://www.fontstuff.com/access/acctut19.htm

    about 2/3 of the way down there is something on sorting options. Sorry if this isn't what you had in mind.

  3. #3
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    how are you launching the report?
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

  4. #4
    Join Date
    Nov 2002
    Location
    Oakland, CA
    Posts
    126
    I have buttons running those reports with a Visual Basic behind it. Thanks

  5. #5
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    buttons, good, that means there is a form.

    create a combo box on the form you are launching the report from containing viable sort order criteria, then pass the criteria to the report via report parameters, or direct reference in the recordsource.
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

  6. #6
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    ...or consider a variation of this using a stripOrderBy() function instead of stripWhere()

    izy
    currently using SS 2008R2

  7. #7
    Join Date
    Nov 2002
    Location
    Oakland, CA
    Posts
    126
    Thank you all for the advice. All very helpful. I actually went with the URL suggested at the second reply and it worked great till...

    What I did is that I open a report and then use a form that creates order by, works great. However, ran into a different issue - and it's probably not too big.

    Originally the database was built that each report button (there is about 20) has it's own code that says docmd.openreport and hardcoded report.

    When I do the sorting of the report I need to have the report name but since I don't want to have 20 forms hard coded with the report name, I'm looking for the code. And this is what I did so far

    I created a new module:

    Option Compare Database
    Option Explicit
    Global RName As String

    Function GetRptName(RptName As String) As String

    RName = RptName

    End Function


    Now, each of the 20 button has a line in the code that says

    GetRptName ("theReportName")

    The very last code I need to put in is for the "Apply Sort" button on my Sorting Form and that' where I get stuck. I try to use stuff like

    If SysCmd(acSysCmdGetObjectState, acReport, RName) <> acObjStateOpen Then

    or

    With Reports!RName
    .Filter = strFilter
    .FilterOn = True
    .OrderBy = strSortOrder
    .OrderByOn = True
    End With


    It's probably something very silly (naming convention) but I can't figure it out... . Please help

  8. #8
    Join Date
    Nov 2002
    Location
    Oakland, CA
    Posts
    126
    any thoughts?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •