custom sort order for a report?

  • Thread starter Thread starter Grant
  • Start date Start date
G

Grant

how do you create a custom sort order for a report field?
I can do it easily for a query field but that alters when
i but it into a report?
 
If you can achieve it in a query, then make the calculated field in the
query, and nominate it in the report's Sorting And Grouping dialog.
 
Grant,

Use the Sorting & Grouping feature in report design to control the
sorting in the report. This can be based on fields from the report's
underlying query, including calculated fields, or you can type an
expression into the Sorting & Grouping dialog.
 
Yes, except you wouldn't preface it with an alias name for the
calculated field, just precede the expression with a = as you would if
you were using it as the controlsource of a calculated control on a form
or report. And all the fields you refer to in the expression have to be
included in the report's recordsource.

I would generally find it easier to make the calculated field in the
query, and then just use this directly in the Sorting & Grouping.
 
Sorry to be a pain about this but i am having trouble to
get the syntax working.

In a query i would use customsort like this:

Customsort:Switch([color]="Red","a",[color]="Blue","b",
[color]="Green","c")

could you please with the example above show me the
correct sytax to enter into a report sort field to
achieve the same results.
 
Grant,

The way I would do it is define the CustomSort field in your query, as
you have done here, and then simply use CustomSort in the sorting of the
report. However, as long as the Color field is included in the report's
recordsource, I believe it will also work to put this in the report's
sorting...
=Switch([color]="Red","a",[color]="Blue","b",[color]="Green","c")
 
Thanks alot for all your help :)

-----Original Message-----
Grant,

The way I would do it is define the CustomSort field in your query, as
you have done here, and then simply use CustomSort in the sorting of the
report. However, as long as the Color field is included in the report's
recordsource, I believe it will also work to put this in the report's
sorting...
=Switch([color]="Red","a",[color]="Blue","b",[color] ="Green","c")

--
Steve Schapel, Microsoft Access MVP

Sorry to be a pain about this but i am having trouble to
get the syntax working.

In a query i would use customsort like this:

Customsort:Switch([color]="Red","a",[color]="Blue","b",
[color]="Green","c")

could you please with the example above show me the
correct sytax to enter into a report sort field to
achieve the same results.
.
 
Back
Top