Results 1 to 3 of 3
  1. #1
    Lounger
    Join Date
    Jan 2001
    Location
    Victoria, Texas, USA
    Posts
    28
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Combo Boxes (97)

    I have a orders form where I can select a customer from a combo box. The cb shows the customer name and stores the customer Id. After the customer is selected the customers address is displayed. There is a subform on the orders form where the order items are selected for the order. On the Orderitems form there is a combo box where the item name is displayed and the ItemID is stored in the underlying table. I would like to be able to display the items in two ways, one is to display all items and two is to display just the items the customer has purchased previously. I have the cb box displaying all the items but I cannot figure out how to display just the previously ordered items.
    Any help would be greatly appreciated.
    Jim B.

  2. #2
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts

    Re: Combo Boxes (97)

    Write a query that selects all the items every ordered by this customer. You will have to join a few tables to do this:
    products, orders, orderitems, customers. Set the criterion in the query to the combobox at the top of the form where you choose the customer.
    To avoid multiple listings or product that have been ordered more than once, you will need to go to SQL view, and the the word "Distinct" after the select.
    You could change the rowsource of the product combo box in code to change between the two lists. You would probably need to requery the combo box after you change its row source (although this may happe automatically, I can't remember). this code could be attached to a command button.
    Regards
    John



  3. #3
    Lounger
    Join Date
    Jan 2001
    Location
    Victoria, Texas, USA
    Posts
    28
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Combo Boxes (97)

    John,
    Thanks for the information. I finally got back and had a chance to try what you recommended and it works great.
    Thanks
    Jim B.

Posting Permissions

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