Results 1 to 2 of 2
  1. #1
    B30 is offline Novice
    Windows Vista Access 2007
    Join Date
    Sep 2014
    Posts
    21

    Exclamation Report Sorting

    Reference: https://www.accessforums.net/reports...orm-24335.html



    I am attempting to do the same thing datadude60 was and I came across this thread. Did anyone ever come up with a way to do this? I have a form that allows the user to filter the data by date range and send the results to a report. I have the report grouped, but I would like to allow the user to select a sort order within the group. I imagined a combo box on the form letting them choose which field from the query to sort on. Maybe multiple combo boxes for multiple levels of sorting. Is this possible?

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,550
    This works for me...

    Code:
    Private Sub btnSetRptSort_Click()
    Dim sFld As String
    Dim rpt As Report
    Dim vRpt
    
    sFld = Forms!frmMain!cboFld   'user picked sort fld
    vRpt = "rRpt"
    
    DoCmd.OpenReport vRpt, acViewDesign
       Set rpt = Reports(vRpt)
       ''rpt.printer = "Brother"
       rpt.OrderByOn = True
       rpt.OrderBy = sFld
    DoCmd.Close acReport, rpt.Name, acSaveYes
    DoCmd.OpenReport vRpt, acViewPreview
    Set rpt = Nothing
    End Sub

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

Similar Threads

  1. Report Re-Sorting Command
    By gbwiii in forum Reports
    Replies: 14
    Last Post: 10-20-2013, 07:22 PM
  2. Sorting a report
    By tylerg11 in forum Reports
    Replies: 1
    Last Post: 12-14-2012, 03:25 PM
  3. Sorting and Grouping in a report
    By Lisa Perry in forum Reports
    Replies: 3
    Last Post: 06-06-2012, 10:43 AM
  4. Report Sorting Issue
    By cbgroves in forum Reports
    Replies: 14
    Last Post: 12-01-2011, 08:44 AM
  5. Incorrect sorting in report.
    By jonesy29847 in forum Reports
    Replies: 2
    Last Post: 06-16-2010, 05:56 PM

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