SELECTION for list boxes

Discussion in 'Web Design & Coding' started by Sanchez, Jul 15, 2004.

  1. Sanchez

    Sanchez 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 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???

  2. lad_in_brum

    lad_in_brum OSNN Addict

    Birmingham, UK
    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!
  3. dave holbon

    dave holbon Moderator

    London England
    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.

    :) :)
  4. Sanchez

    Sanchez OSNN Junior Addict

    thanks, this is all good now