Modify alphabetic sort

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

Guest

I have a combo box on a form. The cb is populated from a query and displays
the Description field sorted ascending.

The problem is that there is an entry "Other" that the client wants to
appear at the end of the list. I have suggested renaming the record to
"Undefined" but that is not acceptable.

After looking at both the ASCII and ANSI tables I prefixed "Other" with "~"
and much to my surprised it was then first in the list.

Any suggestions, please
 
You could force the word Other to the bottom of the list by setting the
combo's RowSource to something like this:
SELECT ItemName
FROM tblItem
ORDER BY (ItemName <> 'Other'), ItemName;
 
You can create a Calculated Column in your Query like:

IsOther: [Description] = "Other"

which returns a boolean value 0 (False) or -1 (True)

then sort the rows returned by the Query by [IsOther] Descending first and
then the Field [Description] Ascending second.
 
Thank you Allen and Van

Much more elegant than my approach.
--
Graham


Van T. Dinh said:
You can create a Calculated Column in your Query like:

IsOther: [Description] = "Other"

which returns a boolean value 0 (False) or -1 (True)

then sort the rows returned by the Query by [IsOther] Descending first and
then the Field [Description] Ascending second.

--
HTH
Van T. Dinh
MVP (Access)



Graham said:
I have a combo box on a form. The cb is populated from a query and
displays
the Description field sorted ascending.

The problem is that there is an entry "Other" that the client wants to
appear at the end of the list. I have suggested renaming the record to
"Undefined" but that is not acceptable.

After looking at both the ASCII and ANSI tables I prefixed "Other" with
"~"
and much to my surprised it was then first in the list.

Any suggestions, please
 

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

Similar Threads

sort alphabetical in report 4
Sort order in report 2
Sort with Combo box 2
Sorting Month-Year in Query 7
Alphabetical table 3
Sorting 1
Combo Box Alphabetical Order 2
sort alphabetically 2

Back
Top