passing sort criteria from form to query

G

Gonzosez

I have a report on the form the user is asked how to sort the report
ascending or descending. How can I pass this to the query?
I do not want to have 2 queries.
 
M

Marshall Barton

Gonzosez said:
I have a report on the form the user is asked how to sort the report
ascending or descending. How can I pass this to the query?
I do not want to have 2 queries.


Actually, a report's sorting is specified in its Sorting and
Grouping, not in a query (this is different from forms).

Set the field you want to sort by in Sorting and Grouping
(View menu when in report design view). Set it to sort
Ascending.

Then use the report's Open event to change it to Descending
using code something like:

If MsgBox("Sort Descending", vbYesNo) = vbYes Then
Me.GroupLevel(0).SortOrder = True
End If
 
Top