SELECTION for list boxes

Sanchez

OSNN Junior Addict
Joined
8 Jun 2004
Messages
14
My Database keeps track of blood samples and the date they were frozen.

Right now I have a combo box connected to a listbox...so that when you select a date in the combo box all the blood samples frozen on that date appear in the list box. However, I also added a "ALL" entry in the combo box. I want it so that when this is selected all of the blood samples in the database will appear in the list box.

Right now under properties for the listbox I have this for row source:

SELECT [CORD Data Table].[Cord Number], [CORD Data Table].Date FROM [CORD Data Table] WHERE [CORD Data Table].Date=forms![cord data form]!datecombo

How can I modify this statement or even go into the function AfterUpdate for the Combobox so that when I select ALL in the combobox all the values will appear in the list box???

THANKS.
 
If you want to return all, cant you just remover the where section and have

SELECT [CORD Data Table].[Cord Number], [CORD Data Table].Date FROM [CORD Data Table]


Or if you give 'All' a vlue of <> 'Nul' then the SQL will return everything where the date isnt blank...i.e everything

I hope that helps!
 
Before answering this question it is prudent to ask what database (I presume Access and Visual Basic) you are using and the version number.

List boxes and combo-boxes have different properties in Access (whatever version you are using). Both can be manipulated programmatically but they have their own limits, for instance an index (unique identifier) is almost always used for combo boxes using an underlying query or SQL statement to return the list of records for (usually fixed items), list boxes can contain just about anything in any list. These can be bound together to provide the expected result or used to provide just about any result, however you can only achieve this (any required result) but using programming techniques and not direct linking as provided by the inbuilt wizards.

Please state you environment. I will then continue with the rest of the explanation.

:) :)
 

Members online

No members online now.

Latest profile posts

Also Hi EP and people. I found this place again while looking through a oooollllllldddd backup. I have filled over 10TB and was looking at my collection of antiques. Any bids on the 500Mhz Win 95 fix?
Any of the SP crew still out there?
Xie wrote on Electronic Punk's profile.
Impressed you have kept this alive this long EP! So many sites have come and gone. :(

Just did some crude math and I apparently joined almost 18yrs ago, how is that possible???
hello peeps... is been some time since i last came here.
Electronic Punk wrote on Sazar's profile.
Rest in peace my friend, been trying to find you and finally did in the worst way imaginable.

Forum statistics

Threads
62,015
Messages
673,494
Members
5,621
Latest member
naeemsafi
Back