any way to sort rather than A to Z

S

steve

Hi
Is there any way I can sort data in a report other than
assending or desending. We have priority system that
user the letter D, P and C. D=Highest priority, P=Middle
and C lowest. I would like to sort my report to display
in this order. Any ideas? (The letters are set in
stone - I cant change to ABC - unfortunatly)

cheers Steve
 
R

Roger Carlson

If you don't already have one, create a small table that has the priority
letter in one field an a number in the other. Eg:

Priority SortOrder
D 1
P 2
C 3

Now in a query, join this table to the other on the Priority fields. Do not
show the SortOrder field in the field list, but use it to sort the recordset
that the query returns.

--Roger Carlson
www.rogersaccesslibrary.com
 
J

jmonty

Create your own "priority" sort field:
The report is based on a table or query. Change it to use
a query or in the Report's RecordSource property use the
query builder.
Either way, add a field to the query. We'll call PTY for
now. The actual values from your table reside in what
field? We'll call it Priority for now.
Now in the query used a nested IIf() statement to change
the values of the priority field into 1,2,3 or A,B,C -
your choice:

PTY: IIf([Priority]="D",1,IIf([Priority]="P",2,IIf
([Priority]="C",3,4)))

Now the value for PTY will be a 1 if Priority is a "D", it
will be a 2 if it is a "P", it will be a 3 if it is a "C",
and it is necessary to complete the function to make it a
4 when it is anything other than D,P, or C.

** See Help for more on how the IIF() function works

Sort your report on the field (PTY) and just make the
field & label for PTY Visible properties = No.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top