How to sort data but not in alphabet order

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi
I need to sort the data in precedence order , not in alphabetic one. Like
Sr.V.I.P is the First, V.I.P is 2nd. Department Manager is 3rd. Team Leader
is 6th, analyst is 9th and ..... Suppose I have 2 fields, One is management
Level as explained above and the other is Name

Thanks,
Saeid
(e-mail address removed)
 
Hi
I need to sort the data in precedence order , not in alphabetic one. Like
Sr.V.I.P is the First, V.I.P is 2nd. Department Manager is 3rd. Team Leader
is 6th, analyst is 9th and ..... Suppose I have 2 fields, One is management
Level as explained above and the other is Name

Thanks,
Saeid
(e-mail address removed)

Access can only sort in alphabetical order or numeric order, so you'll
need to add another column to whatever query is used as recordsource
for your form or report:
SortThisWay:IIf([Title] = "Sr.V.I.P.",1,IIf([Title] =
"V.I.P.",2,IIf([Title] = ... etc....)))

Sort by this number column.

You can also use a User defined function using Select Case, or
If..Then ..Else if you have too many titles to sort using IIF(), and
call the function from the query.
 
fredg said:
Hi
I need to sort the data in precedence order , not in alphabetic one.
Like Sr.V.I.P is the First, V.I.P is 2nd. Department Manager is
3rd. Team Leader is 6th, analyst is 9th and ..... Suppose I have 2
fields, One is management Level as explained above and the other is
Name

Thanks,
Saeid
(e-mail address removed)

Access can only sort in alphabetical order or numeric order, so you'll
need to add another column to whatever query is used as recordsource
for your form or report:
SortThisWay:IIf([Title] = "Sr.V.I.P.",1,IIf([Title] =
"V.I.P.",2,IIf([Title] = ... etc....)))

Sort by this number column.

You can also use a User defined function using Select Case, or
If..Then ..Else if you have too many titles to sort using IIF(), and
call the function from the query.

Or create a TitlePrecedence table, with fields Title (text) and
Precedence (number) to associate each title with its numeric precedence.
Then, in a query, join that table to the original table on the Title
field, and sort on the Precedence field. Although that takes a bit more
setting up, I think it would be more flexible.
 
Create a table with two columns: Title and TitleRank where Title may be Sr.
VP, VP, Director, Manager etc. In the Titlerank column enter a numeric value
corresponding to the sort order.

Rafi
 
Back
Top