• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

SELECTION for list boxes


OSNN Junior Addict
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???

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 posts

Latest profile posts

Hello, is there anybody in there? Just nod if you can hear me ...
What a long strange trip it's been. =)

Forum statistics

Latest member