Results 1 to 7 of 7
  1. #1
    Silver Lounger
    Join Date
    Jan 2002
    Posts
    1,615
    Thanks
    0
    Thanked 1 Time in 1 Post

    Sort Choice for a report (2002)

    Hi,

    I have a report that presently sorts on [store_id]. The user would like the option of sorting either on [store_id] or [agency_id]. I wasn't sure if this was possible.

    Thanks,
    Leesha

  2. #2
    5 Star Lounger
    Join Date
    Nov 2004
    Location
    Wilmington, North Carolina, USA
    Posts
    1,196
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Sort Choice for a report (2002)

    I would start by trying something like this, though I'm not sure this will work (and no time to test, but it should at least be in the right direction....if this doesn't help try typing "Report Order By" in the access help)
    Go to your report properties, change Order By On to yes, and create a combo box on the form that has the command button to open the report. Or have your form open another "Choose sort by" form, and use the Change property for a combo box to trigger the opening of your report. Either way, set order by
    =[forms]![YOURFORM]![COMBOBOX], where your combo box contains the sort options.
    ____________________________
    Jeremy
    "If you spend more on coffee than on IT security, then you will be hacked. What's more, you deserve to be hacked." -Richard Clarke

  3. #3
    Silver Lounger
    Join Date
    Jan 2002
    Posts
    1,615
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Sort Choice for a report (2002)

    Hi,

    Thanks for your reponse. I did as you suggested (didn't fing the help section to be too helpful) and after a parameter issue that I got past, the report opens OK but doesn't sort. I took out the sort order I had originally assigned to the report and made sure there were not sorts in the query but that didn't help.

    Leesha

  4. #4
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts

    Re: Sort Choice for a report (2002)

    Use the on open event of the report to set the sort order based on the vaue in the combo box.

    This example checks the value of an option group, so it i looking for numbers.
    <pre>Private Sub Report_Open(Cancel As Integer)

    If Forms!frmVendorlotList!optsort = 1 Then
    Me.OrderBy = "LotNo"
    Else
    Me.OrderBy = "Stockcode"
    End If
    Me.OrderByOn = True
    End Sub
    </pre>

    Regards
    John



  5. #5
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Sort Choice for a report (2002)

    In addition to John's suggestion, you'll find more info in MSKB article ACC2000: How to Sort a Report from a Pop-Up Form.

    I have attached a demo based on that article.

  6. #6
    Silver Lounger
    Join Date
    Jan 2002
    Posts
    1,615
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Sort Choice for a report (2002)

    This worked perfect!

    Thanks,
    Leesha

  7. #7
    Silver Lounger
    Join Date
    Jan 2002
    Posts
    1,615
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Sort Choice for a report (2002)

    Thanks for the added info Hans! You guys are the best,

    Leesha

Posting Permissions

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