Results 1 to 4 of 4
  1. #1
    jordanturner is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Sep 2010
    Location
    Burnley, England
    Posts
    32

    Filter Combo Box with YES/NO Fields when item is discontinued


    Hi,

    I have recently added yes/no field to stock items to show when they are discontinued and appear as check boxes on the stock form. I have a purchase order form with a combo box to select items for ordering. The items displayed in the combo box are also filtered by supplier, so when a supplier is selected, then only items from that supplier are displayed. The combo box is based on a query.

    I would like to filter the combo box so that a product will not be displayed in the list if it is discontinued. I was thinking I could do this with an SQL iff statement but am unsure how the code should look.

    The current code for the combo box is:

    SELECT tblStock.StockID, tblStock.ItemName, tblStock.SupplierID
    FROM tblSupplier INNER JOIN tblStock ON tblSupplier.SupplierID=tblStock.SupplierID
    WHERE (((tblStock.SupplierID)=[forms]![frmPurchaseOrderBT]![SupplierCombo]))
    ORDER BY tblStock.ItemName;

    Any ideas would be very helpful

    Thank you

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,522
    Along the lines of:

    WHERE tblStock.SupplierID=[forms]![frmPurchaseOrderBT]![SupplierCombo] AND DiscontinuedFieldName = False
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    jordanturner is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Sep 2010
    Location
    Burnley, England
    Posts
    32
    Thanks pbaldy,
    not too sure why that caused me such confusion. I was just thinking of an iff statement but what you said worked.

    Really appreciate the help.

    Thanks again

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,522
    Happy to help.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. filter value in a combo box
    By dada in forum Programming
    Replies: 3
    Last Post: 09-05-2010, 01:22 PM
  2. Replies: 24
    Last Post: 09-01-2010, 02:09 PM
  3. Combo Box filter – help!
    By catat in forum Forms
    Replies: 1
    Last Post: 08-24-2010, 04:15 PM
  4. Combine one item fields in one field
    By romadm in forum Reports
    Replies: 7
    Last Post: 06-04-2010, 11:09 PM
  5. Combo-box to select item to edit in Form
    By DHavokD in forum Forms
    Replies: 7
    Last Post: 06-05-2009, 01:39 PM

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