• Filter (Access 2003)

    Author
    Topic
    #441618

    I have a form with 2 subforms. I have set up a command button so that a user can filter – but it only allows a filter on the main part of the form not the 2 subforms. How can I set it up so that it would also allow the user to filter by either of the subforms?

    Viewing 1 reply thread
    Author
    Replies
    • #1060905

      Hi Robin

      Just seeking clarity here, so excuse the further questions. Can I assume:

      1) The macro/VBA code to the button is in a module?
      2) In the subforms will you be filtering on similar fields?

      and as a note of opinion, without seeing your design, I am just a little worried having filters on these areas , how do you clear them after use?

    • #1060916

      In addition to Jerry’s questions, what is it you’re trying to filter. If the subforms are linked by master/child links, they’re filtered automatically by any filter applied to the parent form. If you’re trying to filter the parent from the subform, why?

      • #1060954

        I guess I didn’t explain this very well. I have a form that has a command button that the user can click on and activate the Filter by Form option. From the form the user can select anything on the main form and click apply filter and it filters for the main form and the 2 subforms. What I would like the user to be able to do is click the command button then be able to click into either of the 2 subforms make a selection or set criteria then click apply filter.
        thank you in advance to all that can help

        • #1060960

          In what format are the subforms?

          If you have then as a single or continuous form you can put a filter button on them but if it is datasheet, you can’t

          • #1060976

            Yes, they are datasheet view.

            • #1060978

              Why do you need a command button for the Filter By Form option? There is a toolbar button for it. You could create a custom toolbar for your form and subforms with the Filter by Form button (and others) to make sure that it is always available.

            • #1060985

              I thought it would be easier for the person using the DB to have a button that they could click. I can do the toolbar but I’m still not sure how to get the filter on subform. When I try – it just filters the subform.
              thanks
              Robin

            • #1060988

              Filter by Form affects only the form that has the focus when you invoke it. If the focus is on the main form, the main form will be filtered, and if the focus is on one of the subforms, that subform will be filtered (without any effect on the main form). If you want to filter the main form at the same time as the subform, you’d have to create your own form for it, and write lots of code.

            • #1060989

              Thanks Hans – don’t know how to write code so will have to do with what I have.

    Viewing 1 reply thread
    Reply To: Filter (Access 2003)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: