Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

combo BOX/List BOX Question

Status
Not open for further replies.

Compuboy

Programmer
Jun 8, 2004
38
US
OK....
I'm writing a DB to keep track of CORD DNA samples.

Right now I have all my sample names in a list box. I also have a combo box with all the dates and a search button.

Right now when you select a date in the combo box only the samples frozen on that date will show up in the list box..however, I also want an item "all" in my combo box where all the samples will show up. But it says it must be a value list instead of table/query. Is there anyway of doing it. If not I could settle for a button on the side that sets the combobox value to blank and puts all the samples in the list box. The problem is I don't know how to do this because of the query that the list box is based on.


If the combobox is blank, it will not select anything in the list box because it only selects the sample when the dates match...(e.g. nothing would match a blank.)

IDEAS? THANKS
 
Compuboy
What you have to do is turn the SQL for your combo box Row Source into a Union query.

SELECT YourTable.RecordID, YourTable.YourDateField
FROM YourTableName
UNION
SELECT '0','<ALL>'
FROM YourTableName
ORDER BY YourTableName.RecordID;


The '0' and the '<ALL>' force the <ALL> to the top of the list.

You will, of course, need to change the field names. You may also have to add additional blank fields in the second SELECT line to match the number of fields in your first SELECT line.

Try it and see how it goes.

Tom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top