Results 1 to 15 of 15
  1. #1
    gbwiii is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2011
    Posts
    20

    Report Re-Sorting Command


    My report is sorted using a query by Work Center, but it would be great if at the bottom of the report I could click on a button and have it resort the report by Aircraft Tail Number. Open to suggestions, my programming skills are limited !

    Thanks

  2. #2
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows XP Access 2003
    Join Date
    Aug 2013
    Posts
    7,862
    OrderBy does not seem to be available after the report is opened. I can only get it to work as the report loads, in the load event.
    Last edited by ItsMe; 10-20-2013 at 03:19 PM. Reason: Typo and clarification

  3. #3
    gbwiii is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2011
    Posts
    20
    Yes - I am trying to resort a report not a form

  4. #4
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows XP Access 2003
    Join Date
    Aug 2013
    Posts
    7,862
    Sorry, typo. I meant to say report. Once the report opens the only function that seems to be available to alter the report is filter.

    Up until today I was unaware that you could even do that or place a control button on a report. Quite frankly, I am befuddled.

  5. #5
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,530
    The report would have to be in Report view (new in 2007). I do this type of thing:

    Code:
      Select Case Me.FraSort
        Case 2
          Me.BreakDownSheet.Report.GroupLevel(0).ControlSource = "SortOrder"
        Case Else
          Me.BreakDownSheet.Report.GroupLevel(0).ControlSource = "Car_No"
      End Select
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  6. #6
    gbwiii is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2011
    Posts
    20
    Thanks - Will keep searching !

  7. #7
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,530
    Looks like we were posting at the same time, so wanted to make sure you saw post 5.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  8. #8
    gbwiii is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2011
    Posts
    20
    Yes - I see it now but I am trying to make sense of it. So if I create a command button on my report and then on the Click Function enter this code.

  9. #9
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,530
    Mine is used with an option group in the main report changing a subreport. You can certainly use a button, I was just showing what property you'd change.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  10. #10
    gbwiii is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2011
    Posts
    20
    Thanks - I will try the options group also

  11. #11
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows XP Access 2003
    Join Date
    Aug 2013
    Posts
    7,862
    Paul

    Have you gotten it to work on anything other than a subreport? I must still be befuddled.

  12. #12
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,530
    If you really have 2003, it uses a view you haven't got. Report view, new with 2007, allows interactivity like buttons and such.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  13. #13
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows XP Access 2003
    Join Date
    Aug 2013
    Posts
    7,862
    Paul,

    I don't want to Hi-Jack the OP's thread. I tried it out in Access 2010 and could not get it to work anywhere other than the load event. That is when I posted with Post # 2. I read the help files and they mentioned Grouplevel was only good at the time the report loaded.

    Later I will try again and duplicate what you have there. Although I have had Access 2010 for over 3 years, I am just now starting to learn it. Hence, I am often befuddled.

  14. #14
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,530
    Make sure it's talking about Report view rather than Preview/Print. I would certainly agree that the above code would only work at the time the report loaded with Preview or Print. The db I copied that from is 2007, but I'd think 2010 would work similarly. I can try it with 2010 tomorrow on a VM. If memory serves, I used a report/subreport so that the various option groups would remain at the top, allowing users to change the filtering/sorting of the subreport at will. That code is all in a function called from the click events of the option groups. The function sets the record source of the subreport, then the group level as above. It has worked perfectly for years.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  15. #15
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows XP Access 2003
    Join Date
    Aug 2013
    Posts
    7,862
    I had the Report View vs. Preview thing correct. Not sure what exactly was going wrong but I built out a different report/subreport and got it to work on both straight report and on the subreport. Very cool indeed.

    I like the idea of having the case select with an option group in a Main report to control sort order in a subreport. Anyway, tested the following in basic click event.

    for a subreport
    Me.SubReportContainer.Report.GroupLevel(0).Control Source = "TextControlName"

    or


    in the haeder of a report
    Me.GroupLevel(0).ControlSource = "TextControlName"

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

Similar Threads

  1. Sorting a subform within a Report help
    By Lorlai in forum Reports
    Replies: 4
    Last Post: 03-21-2013, 08:11 AM
  2. Sorting a report
    By tylerg11 in forum Reports
    Replies: 1
    Last Post: 12-14-2012, 03:25 PM
  3. Report Sorting Issue
    By cbgroves in forum Reports
    Replies: 14
    Last Post: 12-01-2011, 08:44 AM
  4. sorting a field in report
    By Philangr8 in forum Reports
    Replies: 3
    Last Post: 08-26-2009, 05:38 PM
  5. Sorting data in a report
    By rjsiler in forum Reports
    Replies: 1
    Last Post: 08-04-2008, 01:40 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