Changing Order By in subform not working as expected RRS feed

  • Question

  •  I have a form with a subform that displays records sorted on the Order By property of the subform correctly.  Sometimes the user needs to see the records in the subform displayed in a different sequence.  I thought the following VBA code would change the sort order and requery the recordsource of the subform and display the contents of the subform by last name. 

    The debug.print indicates the order by is being changed but the order of the records displayed does not change.  It is as if the requery is not working.

     Me.[RecordScoresSubform].Form.OrderBy = "LastName DESC"
     Debug.Print Me.[RecordScoresSubform].Form.OrderBy


    Any and all suggestions, comments, and/or sample code is appreciated.

    Wednesday, April 20, 2011 4:13 AM


  • Try....

    Me.[RecordScoresSubform].Form.OrderBy = "LastName DESC"
    Me.[RecordScoresSubform].Form.OrderByOn = True

    • Marked as answer by Bruce Song Tuesday, April 26, 2011 5:56 AM
    Wednesday, April 20, 2011 4:33 AM