How to arrange values in combo box

J

Jack

Hi,
I have a combo box where it lists a single field recordset. However, this
recordset has a value all. Is there any way to display ALL first and then
display rest of the records in a ascending manner? In other words ALL should
be at the top and should not be affected by the ordering of other records.
Thanks for any help in advance.
 
T

tina

try the following SQL statement in your combo box's RowSource, as

SELECT MyTable.MyField FROM MyTable ORDER BY IIf([MyField]="ALL",0,1),
MyTable.MyField;

substitute the correct table and field name, of course, and put the
statement on one line in the RowSource.

hth
 
M

Marshall Barton

Jack said:
I have a combo box where it lists a single field recordset. However, this
recordset has a value all. Is there any way to display ALL first and then
display rest of the records in a ascending manner? In other words ALL should
be at the top and should not be affected by the ordering of other records.


If the recordset comes from a table, just change the ALL
record to put a space in front of it. A space will sort
before any letters or numbers in the other revords.
 
J

Jack

Thanks for your help Tina. I am going to try your code with my parameters.
Regards

tina said:
try the following SQL statement in your combo box's RowSource, as

SELECT MyTable.MyField FROM MyTable ORDER BY IIf([MyField]="ALL",0,1),
MyTable.MyField;

substitute the correct table and field name, of course, and put the
statement on one line in the RowSource.

hth


Jack said:
Hi,
I have a combo box where it lists a single field recordset. However, this
recordset has a value all. Is there any way to display ALL first and then
display rest of the records in a ascending manner? In other words ALL should
be at the top and should not be affected by the ordering of other records.
Thanks for any help in advance.
 
J

Jack

Thanks for your help Marshall. I appreciate it.

Marshall Barton said:
If the recordset comes from a table, just change the ALL
record to put a space in front of it. A space will sort
before any letters or numbers in the other revords.
 
P

PC Datasheet

Or ----------

Use All like this: <All>

The "<" sorts before any letters or numbers in the other records.
 

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

Split form 0
Combo box 0
Combo or list box 0
list or combo box 0
Retain combo box order 2
Formatting combo box drop-down list 2
Auto-populate comboBox with value from Row Source 2
Combo Box On Click 8

Top