Results 1 to 4 of 4
  1. #1
    Lounger
    Join Date
    Apr 2010
    Location
    Sofia
    Posts
    26
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Can I apply a filter on the subform? With my main form, called frmoffers, I choose the customer and then with the subform I choose the products.I want to place a button on my main form to choose the supplier, for example:
    strFilter = "products.supplierid = 1"
    Me.Filter = strFilter
    Me.FilterOn = True

    But how can I refer to the subform and can i filter it?

  2. #2
    5 Star Lounger AndrewKKWalker's Avatar
    Join Date
    Apr 2001
    Location
    Cambridge, UK
    Posts
    1,020
    Thanks
    0
    Thanked 3 Times in 3 Posts
    The General Syntax to reference a subform is

    SubFormName.Form

    So to apply a filter to the subform which is stored in strFilter

    Me!SubformName.Form.Filter=strFilter
    Me!SubformName.Form.FilterOn=True

    NOTE... SubformName is the name of the SubForm Control, not necessarily the name of
    the saved Subform itself
    Andrew

  3. #3
    Lounger
    Join Date
    Apr 2010
    Location
    Sofia
    Posts
    26
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thank you very much for the helpful advice!

  4. #4
    Star Lounger
    Join Date
    Dec 2009
    Location
    Bellevue, WA
    Posts
    61
    Thanks
    1
    Thanked 0 Times in 0 Posts
    One other way is to link the subform to both the customer and the product. Then you could modify the LinkMasterFields and LinkChildFields (I forget the exact names offhand) to show the selected customer and all products or the selected customer and selected product. Just another way to do it - and probably the way I'd approach it.

Posting Permissions

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