Using Checkboxes to sort report

lovett10

Registered User.
Local time
Today, 14:14
Joined
Dec 1, 2011
Messages
150
Hi thanks in advanced for any help.

I have 3 checkboxes in my form i wish to when checked and search button is pressed to open the report and sort it by the corresponding field

heres what i have so far...

Code:
If Me.chkQuoteNumber.Value = True Then

yea not alot :D i think i might need to use OrderBy somewhere but arent really sure how it works.

P.s My report is called "VisitSheetTableReport" and for this example my field that i want to sort is called "Quote Number"

P.P.S I am using Access 2010

P.P.P.S thanks for any help much appreciated :)
 
You first need to build the SQL statement then pass it to the report's OrderBy method. The other thread deals with the main part of this process, i.e. building the SQL.
 
You first need to build the SQL statement then pass it to the report's OrderBy method. The other thread deals with the main part of this process, i.e. building the SQL.

So i need to Select my report first?
 
You need to open the report first, then apply a sort on it. That's the easiest way. There's a more complicated way which requires more coding but it allows more flexibility.
 
You need to open the report first, then apply a sort on it. That's the easiest way. There's a more complicated way which requires more coding but it allows more flexibility.

Code:
 DoCmd.OpenReport "VisitSheetTableReport", acViewReport, , strFilter

Then how do i select the report to apply the sort?
 
Code:
Reports!VisitSheetTableReport.OrderBy = "[QuoteNumber] DESC"
Reports!VisitSheetTableReport.OrderByOn = True
 
That was just an example of what you can do. You can put ASC if you want.
 

Users who are viewing this thread

Back
Top Bottom