Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2004
    Location
    Dallas, TX
    Posts
    77

    Unanswered: How do I display in combo box from table like this?

    I want to display all contents of one column and the word “All” in combo box. So user can select any item from table or select all for table. I know how to display from table, but I don’t know how to display the all in same combo box, anyone can help? thanks a lot
    Last edited by huela; 11-18-04 at 12:38.

  2. #2
    Join Date
    Jun 2003
    Location
    Belgium
    Posts
    133
    This is possible but a little tricky for beginners.
    Part1 : First you need to get a "*" in the list from your combo. It can be done like this :
    in the RowSource of the combo, write something like this :
    SELECT "*" FROM MyTable UNION SELECT MyTable.MyColumn FROM MyTable;
    where of course you substitute MyTable and MyColumn with the appropriate names of your table and column.
    This will create the list in your combo, preceeded with a "*".

    Part 2 : choosing a value in the combo will probably trigger an event, or the value in the combo is used elsewhere.
    Suppose the second option : the chosen value is used to restrict the view in another form with the code
    Docmd.OpenForm "frmFormB",,,"FieldB = '" & Me!Combo & "'"
    If you change this code into
    Docmd.OpenForm "frmFormB",,,"FieldB LIKE '*" & Me!Combo & "'*"
    you will get what you want : when the user chose a normal value in the combo, the opened form wil be restricted to this value. When he chose the "*", the opened form will not be restricted.

  3. #3
    Join Date
    Sep 2004
    Location
    Dallas, TX
    Posts
    77
    Herman

    thank you very much. It works perfect. appreciate for your help

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •