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.
 
Top