Results 1 to 5 of 5
  1. #1
    Join Date
    May 2010
    Location
    Islamabad
    Posts
    13

    Select "All" from one combo box show all records in other combo box.

    Hey All Dears.

    i am wondering for several hours to reading threads and searching about this problem but i can't fix it till yet.

    I have a form1 containing two combo boxes. cboCategory and cboProduct.
    both combo boxes are unbound.

    cboCategory RowSource property is as under:
    SELECT Categories.CategoryID, Categories.CategoryName FROM Categories;



    and after update event of cboCategory requery the second cboProduct.

    while cboProduct RowSource Property is as under:
    SELECT Products.ProductID, Products.CategoryID, Products.ProductName
    FROM Products
    WHERE (((Products.CategoryID)=[Forms]![Form1]![Combo0]))
    ORDER BY Products.ProductName;

    both work correct. now i want to add word "All" in first cboCategory and when i select "All" beside any Category name then it populate the second combo box cboProduct with All Records.

    can it is possible.

    i try to use a union query to add "All" in first combo box and it works good. but when i select "All" from first combo box it not update the second cbobox and not show all records which are not limit by categoryID.

    any ideas, suggestions about this problem......

  2. #2
    slave138's Avatar
    slave138 is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Oct 2010
    Location
    WI
    Posts
    233
    I would set the value for "All" to a null in the Category combo. In the Product combo, set the query criteria to something like:

    Code:
    WHERE (((Products.CategoryID)=[Forms]![Form1]![cboCategory]) OR [Forms]![Form1]![cboCategory] Is Null)

  3. #3
    slave138's Avatar
    slave138 is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Oct 2010
    Location
    WI
    Posts
    233
    And make sure you requery the Products combo in the OnChange event of the Category combo.

  4. #4
    Join Date
    May 2010
    Location
    Islamabad
    Posts
    13

    Thumbs up Problem Solved

    thanks slave 138 it is working good. when i select "All" from first combo then second pupolate with all records of products.

  5. #5
    slave138's Avatar
    slave138 is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Oct 2010
    Location
    WI
    Posts
    233
    Happy to help

Please reply to this thread with any new information or opinions.

Similar Threads

  1. sql = "Select * From qry_defect" >> ??
    By anggunpus in forum Programming
    Replies: 2
    Last Post: 01-30-2010, 02:45 AM
  2. Fields do not show in "Form View"
    By hawzmolly in forum Forms
    Replies: 4
    Last Post: 01-09-2010, 06:27 PM
  3. Replies: 1
    Last Post: 10-19-2009, 02:37 AM
  4. Replies: 0
    Last Post: 02-24-2009, 12:37 PM
  5. Select "autonumbers" not in sequence
    By jerry525 in forum Queries
    Replies: 5
    Last Post: 11-09-2008, 02:48 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums