[AccessD] Report Data Order Differs From Form or Query DataOrder

Gustav Brock Gustav at cactus.dk
Tue Mar 18 05:32:30 CDT 2008


Hi Max

Well, as your mother would answer when she didn't know the answer: Because it does! 

I guess the reason is that sorting and grouping is considered such an essential part of what a report does that it has been given full control, and to gain this all previous sorting is ignored because it will not be used anyway.
You mention an index and that may be what the report looks for and - if its own sorting is not specified - will use. I'm just guessing but some tests could clarify this.

I can see this represents a problem for you. One method could be to use two variables: one for the SQL expression without sorting, and one to be applied for the sorting. Then use the OnOpen events of the form and the report to, respectively, build an Order By expression to be appended the SQL variable and then used as the form's RecordSource, and be used by a function which sets the sorting in the report (this is quite easy). This way the unsorted SQL could remain identical for each pair of form and report.

Actually, I can't think of any other way to achieve this. The sorting variable could be a series of fieldname/direction like:

  somefield;asc;field2;asc;someotherfield;desc;anotherfield;asc

which easily could be parsed by several methods.

/gustav


>>> max.wanadoo at gmail.com 18-03-2008 10:50 >>>

The Point is this:  Why does the RPORT use a different engine that a FORM when identical query is used.






More information about the AccessD mailing list