Code to change sort

bharlow

Registered User.
Local time
Today, 05:00
Joined
Dec 26, 2008
Messages
52
I have written a ranking report and would like to give the user the ability to rank on different fields in the report. My query gives rankings for all fields.

Is there a way to use code and the on-click event procedure to allow the user to click on the label on the top of each column to change the sort to the ranking for that field?

Any ideas are greatly appreciated!
 
Personally, I would go for
Code:
Me.OrderBy = "fieldname"



What I want to know is, how can I add an additional OrderBy criteria.

In Excel talk, it might sound something like 'Sort by A then by B then by C', but i want to do it from VBA when I click the column header label.

Ta muchly.
 
well you cant click a report (maybe you can in A2007)

best way is to popup a selection form before opening the report, select what you want then use that to drive the report

however, changing report sortorders with code in this way is doable, but not so easy.
 
Sorry.. its not a report. Its a form that returns search results as a Continuous Form with fields all in a line (there are only 3 fields per record).
 
If you use SQL as the form's record source it might look like this:

Code:
SELECT Customers.CustomerID, Customers.CompanyName, Customers.ContactName
FROM Customers
ORDER BY Customers.CustomerID, Customers.CompanyName;

Regards,
Tim
 
well you can just click a column, and then click a-z at the top.

filters work as well

you dont need any code
 

Users who are viewing this thread

Back
Top Bottom