View Full Version : Dynamically Sort Report


Jerry Stoner
01-04-2005, 11:52 AM
I have a report based on a qbf (dynamic query). The query includes an OrderBy that sorts by EndDate, Priority or ProjectName based on user selection on a form. The sort order is correct in the query. The report based on that query has no Sort order stipulated either in code or in the Sorting//Grouping option but always sorts by priority. Any ideas?

llkhoutx
01-04-2005, 09:57 PM
roperts are sorted by the "Sorting and Grouping" icon regardlkess of the report RecordSource ordering.

Jerry Stoner
01-05-2005, 07:46 AM
Thanks for the reply but there is no sort order specified in the sorting and grouping "Icon". There is no specification at all in the report either in code or in the provided options. Thats why it should be defaulting to the query sort order. Really confused as to why this is happening. Tried building a new report from design view (no wizard) also and no help. Any ideas?
Thanks,
Jerry

llkhoutx
01-05-2005, 12:22 PM
I think that the "sorting and grouping Icon" controls for reports, regardless of the report recordsource or not. If no "sorting and groupoing is specified, you'll get the recordsource table default order.

Jerry Stoner
01-05-2005, 12:34 PM
None is specified so I should get the recordsource sort order. In this case a query not a table. The table is ordered by an AutoNum field and the query by Priority or date or name depending on user selection. Anyway I took the cheap way out and made 3 reports with the correct sorting and called them as appropriate but I really hate doing it that way. Any other ideas?

llkhoutx
01-05-2005, 01:28 PM
I know that sort order and grouping can be dynamically set. I'll have to look up how.

Jerry Stoner
01-05-2005, 02:02 PM
I was looking for that also. Best I could find from the developers handbook was Me.GroupLevel(0).SortOrder = "Whatever" but I am not using Grouping and could not find a similar property for the entire report. Also tried OrderBy in the open event to no avail.
Thanks,
Jerry

llkhoutx
01-05-2005, 05:39 PM
Getz, Litwin & Gilbert's Access 2000 Developer's Handbook, Volume 1: Desktop Edition has a section on "Controling Sorting and Grouping" via VBA.

Jerry Stoner
01-06-2005, 06:17 AM
"Best I could find from the developers handbook was Me.GroupLevel(0).SortOrder = "Whatever"
Ch.9 pg:662