Order By - Frustration

T

Tom

Using Access 2002 we have a report whose record source, a SQL string, and
sort order is set at runtime.

At runtime we were are able to select sort order by either date or by
invoice number.

Since a text box was added to the report, to count the records on that
report, the sort order, irrespective of which order we select, the order
remains the same.
That text box has a control source set to = Count([AuditID]), where AuditID
is the primary key field in that table.

Before I seriously hit the vodka bottle can anyone suggest why this is and
how to correct?


Thanks in advance

Tom
 
A

Allen Browne

Reports do not follow the sort order of the query they draw their data
from - not reliably anyway.

Use the Sorting And Grouping dialog to specify the sort order. You can use
the Open event of the report to reassign the ControlSource of the GroupLevel
at runtime. Details in:
Sorting Records in a Report at run-time
at:
http://members.iinet.net.au/~allenbrowne/ser-33.html

If there is nothing in the Sorting'n'Grouping box, you can also set the sort
order via the report's OrderBy property in Report_Open, remembering to set
OrderByOn as well.

Once it's solved, do we all get to share the vodka? :)
 
T

Tom

Cheers Alan

You've saved me from a terrible hangover it worked a
treat!!!!!!!!!!!!!

Tom
-----Original Message-----
Reports do not follow the sort order of the query they draw their data
from - not reliably anyway.

Use the Sorting And Grouping dialog to specify the sort order. You can use
the Open event of the report to reassign the
ControlSource of the GroupLevel
at runtime. Details in:
Sorting Records in a Report at run-time
at:
http://members.iinet.net.au/~allenbrowne/ser-33.html

If there is nothing in the Sorting'n'Grouping box, you can also set the sort
order via the report's OrderBy property in Report_Open, remembering to set
OrderByOn as well.

Once it's solved, do we all get to share the vodka? :)

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Tom said:
Using Access 2002 we have a report whose record source, a SQL string, and
sort order is set at runtime.

At runtime we were are able to select sort order by either date or by
invoice number.

Since a text box was added to the report, to count the records on that
report, the sort order, irrespective of which order we select, the order
remains the same.
That text box has a control source set to = Count
([AuditID]), where
AuditID
is the primary key field in that table.

Before I seriously hit the vodka bottle can anyone suggest why this is and
how to correct?


.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top