I have a tab form with command buttons that allow the user to sort by certain fields. E.g., the user may sort by client name. The command button runs this code on the On Click event:
Me.RecordSource = “select * from [qry_recerts] where ” & sVar & ” ORDER BY [pat_lastname], [pat_firstname]”
(sVar has already been established as a variable for filtering records, e.g.,
=”B”)