Orderby high medium low

F

F0zziebear

Hi,

I want to order a make-table query by high, medium, and then low.

The basic sorting option would do this alphabetically which is no good. Can
someone provide a simple (I think using the orderby) expression to add this
in, so that it doesn't have to be done manually after the event when I export
to excel.

Many thanks

F0zz
 
L

Lance

Instead of using high, medium, low use 1,2,3

if high, medium and low are already in your data, replace your field with
something like:

iif([MY_FIELD] = "high",1,iif([MY_FIELD] = "medium,2,iif([MY_FIELD] =
"low",3,9999)))

then sort on it.
 
J

Jerry Whittle

If the words are only High, Medium, Low something like the following will
work with the proper field and table names. It's ugly, but can get the job
done:

SELECT tblHighMediumLow.*
FROM tblHighMediumLow
ORDER BY Right([Sorting],1);

HOWEVER you might be a little disappointed by the final results. Tables have
no real sort order. Even if you pour the records into the new table in a
certain order using a make-table or append query, there's no guarantee that
they will stay that way inside the table.

Instead of pouring these records into a new table, just use something like
the above query to export them to Excel.
 
L

Lance

missed a quote after medium..

iif([MY_FIELD] = "high",1,iif([MY_FIELD] = "medium",2,iif([MY_FIELD] =
"low",3,9999)))


Lance said:
Instead of using high, medium, low use 1,2,3

if high, medium and low are already in your data, replace your field with
something like:

iif([MY_FIELD] = "high",1,iif([MY_FIELD] = "medium,2,iif([MY_FIELD] =
"low",3,9999)))

then sort on it.


F0zziebear said:
Hi,

I want to order a make-table query by high, medium, and then low.

The basic sorting option would do this alphabetically which is no good. Can
someone provide a simple (I think using the orderby) expression to add this
in, so that it doesn't have to be done manually after the event when I export
to excel.

Many thanks

F0zz
 
F

F0zziebear

Lance,

The fields you a drop-down menu of high medium and low.

I want to check do you mean instead of [My_Field] do I put in the Priority
(which is the field name?)

F0zz

Lance said:
Instead of using high, medium, low use 1,2,3

if high, medium and low are already in your data, replace your field with
something like:

iif([MY_FIELD] = "high",1,iif([MY_FIELD] = "medium,2,iif([MY_FIELD] =
"low",3,9999)))

then sort on it.


F0zziebear said:
Hi,

I want to order a make-table query by high, medium, and then low.

The basic sorting option would do this alphabetically which is no good. Can
someone provide a simple (I think using the orderby) expression to add this
in, so that it doesn't have to be done manually after the event when I export
to excel.

Many thanks

F0zz
 
L

Lance

Yeah, just replace "My_Field" with your field name and it should replace the
value with a 1,2,3 or 9999 ( if no matches ).

F0zziebear said:
Lance,

The fields you a drop-down menu of high medium and low.

I want to check do you mean instead of [My_Field] do I put in the Priority
(which is the field name?)

F0zz

Lance said:
Instead of using high, medium, low use 1,2,3

if high, medium and low are already in your data, replace your field with
something like:

iif([MY_FIELD] = "high",1,iif([MY_FIELD] = "medium,2,iif([MY_FIELD] =
"low",3,9999)))

then sort on it.


F0zziebear said:
Hi,

I want to order a make-table query by high, medium, and then low.

The basic sorting option would do this alphabetically which is no good. Can
someone provide a simple (I think using the orderby) expression to add this
in, so that it doesn't have to be done manually after the event when I export
to excel.

Many thanks

F0zz
 
Top