Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

order by on reports specfic sort order

Status
Not open for further replies.

jebushatescats

IS-IT--Management
Jun 6, 2006
37
0
0
CA
Hello all

I need to be able to sort my report by an incoming field called entity_code, this I know how to do but...
the entity_code field will have one of four values
sess
crse
prov
part

If I just order by this field the records will display on the report in the following sort order
crse
part
prov
sess

What I want is to be able to have them sort by the following order

prov
crse
sess
part


Is there a way to hard code in a sort order based on the value of the entity_code?
 
You can do this with a query. Create a table with the sort order and the four values. You can then join this table by Entity_Code to your main table, allowing you to select the SortOrder field to sort by in your report.
 
I would use Remou's solution but there is a short cut if your values will never ever change. Set the sorting and grouping expression to:
=Instr("prov crse sess part",[entity_code])
It is much more functional though to maintain data in applications rather than maintaining expressions.

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top