Combo-box rowsource query AND values?

S

scottydel

Hello,

I'm using Access 2003. I have a combobox that uses a query as its
rowsource. I also need to add one value to the end of the drop-down list,
which is not in the query result.

Is it possible to have something like this?

COMBOBBOX DROP-DOWN LIST VALUES:
Green (record 1 from rowsource query result)
Blue (record 2 from rowsource query result)
Yellow (record 3 from rowsource query result)
Orange (record 4 from rowsource query result)
Red (record 5 from rowsource query result)
No Color (single value not from query result) <- would like to have this too

Any ideas appreciated.

Thanks,

Scott
 
J

Jeff Boyce

Check into using the UNION query. However, if you are going to specify the
order in which the values display, you'll need to include a field that lets
you Order By...

(untested psuedo SQL follows...)

SELECT ColorField, SortOrder FROM tlkpYourColorTable
UNION
SELECT "No Color", 999 FROM tlkpYourColorTable
ORDER BY SortOrder;

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
M

Marshall Barton

scottydel said:
I'm using Access 2003. I have a combobox that uses a query as its
rowsource. I also need to add one value to the end of the drop-down list,
which is not in the query result.

Is it possible to have something like this?

COMBOBBOX DROP-DOWN LIST VALUES:
Green (record 1 from rowsource query result)
Blue (record 2 from rowsource query result)
Yellow (record 3 from rowsource query result)
Orange (record 4 from rowsource query result)
Red (record 5 from rowsource query result)
No Color (single value not from query result) <- would like to have this too


I like to do this kind of thing by creating a one row table
(named OneRow) with one field of any type and any value in
the single record.

THen the combo box's row source query can be like:

SELECT colorID, color FROM colortable
UNION ALL
SELECT 0, "No Color" FROM OneRow
 

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

Top