Results 1 to 6 of 6
  1. #1
    Join Date
    Mar 2002
    Posts
    5

    Unanswered: how to filter a subform?

    HI, thank you for paying attention to my question. I just started to learn access. Many questions came to me, here is one of them.

    I was trying to apply a filter to a subform, but i failed.

    the main form is for order taking in a restaurant. the subform is to display menu items to waiters. Menu items include drink, appetizer, main course and dessert.

    I just want the subform display one of the above four categories at a time, so i applied a filter to the subform.....

    when i opened the subform individually, it was fine. but after i integrated the subform into the main form, the filter always filtered the main form, not the subform anymore.

    anybody could help out> I appreciate any feedback!

  2. #2
    Join Date
    Sep 2001
    Location
    Chicago, Illinois, USA
    Posts
    601
    How are you invoking the filter?

    Do you have an option group, or toggle button group, on the main form which allows you to toggle between your filters?

    Are you simply right-clicking to use the filter? Or, are you using the filter toolbar options?

    You should be doing the option group/toggle button paradigm.

    Let us know.

  3. #3
    Join Date
    Mar 2002
    Posts
    5
    Sorry, I forgot to mention that.

    I used four command buttons, for the four menu item categories.

    so, when I click the drink button, the subform should be able to display all the drinks only, when I l click the Main Course button, all and only the items in the Main Course category should be displayed............
    that's what i was trying to achieve.

    Thanks a lot, PracticalProgram!!!!!!!!!!

  4. #4
    Join Date
    Sep 2001
    Location
    Chicago, Illinois, USA
    Posts
    601
    And underneath each of these command buttons, you are doing what?

    You should be filling the Filter property of the subform with your criteria string and then setting the FilterOn property to True.

  5. #5
    Join Date
    Mar 2002
    Posts
    5

    how to filter a subform without affecting the main form?

    under the four command buttons, i created four AppllyFilter Macros(one for each), including Drink Filter, Main Course Filter, Dessert Filter and Appetizer Filter.

    but whenever I click any of the command buttons, the filter will filter the main form also.
    it would be great for me if the filter only filter the subform and has no effect on other data on the main form.

  6. #6
    Join Date
    Sep 2001
    Location
    Chicago, Illinois, USA
    Posts
    601
    Under each of the command buttons, instead of running macros which run commands, run the commands directly.

    Under each button, do this:

    forms![frmMain]![subFormControlName].form.Filter=ThisIsWhereYourFilterGoes
    forms![frmMain]![subFormControlName].form.FilterOn=True

Posting Permissions

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