Results 1 to 4 of 4
  1. #1
    roger-trigg
    Guest

    Am I attempting the impossible? (97 SR!)

    I'm a beginner struggling with a classic orders/suppliers situation but there's nothing in Northwind that quite matches my requirement. I'm trying to filter a field in a subform with a value the user selects on the main form.
    The main form has a 'supplier' combo box from which the user makes a selection. The subform (linked through an 'order no' field) is based on an 'order details' table and contains an ItemName combo that gets populated form an Items table that lists all items from all suppliers. I want this combo filtered by the supplier selected in the main form. I see the filtering as an 'on enter' event property of the subform but perhaps this is where I'm going wrong. Please tell me I'm not!
    Roger

  2. #2
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    USA
    Posts
    386
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Am I attempting the impossible? (97 SR!)

    One way to filter the subform combo is to set up the "recordsource" property of the combo box to use the supplier selected on the main form.

    the code would look somthing likw this.

    SELECT ItemName FROM tblOrderDetails WHERE Supplier = Forms!MainForm.cboSupplier

    Good Luck

    Richard Aheron
    raheron@hotmail.com
    <img src=/S/electric.gif border=0 alt=electric width=15 height=15>
    Richard

  3. #3
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

    Re: Am I attempting the impossible? (97 SR!)

    What Richard said is the way to go, except that you will have to manually tell the subform combo box when to requery. Probably in the AfterUpdate event of the mainform combo box, or possibly the AfterUpdate event of the Mainform itself.
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  4. #4
    roger-trigg
    Guest

    Re: Am I attempting the impossible? (97 SR!)

    Thanks for those leads, guys. I've now got the items combo on the subform populated with items from just one of the suppliers but am struggling to get the requery side of things working so that the combo gets updated with a newly chosen suppliers' items. But I'll get there, I hope!
    Roger

Posting Permissions

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