Continuous filtering with a module?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Kevin

    Continuous filtering with a module?

    I want to use a set of check boxes to narrow down entries on a subform. I.e.
    a check box for black, red & green to describe the colors of a product. So a
    use clicks Black and only black products are shown, the click green and only
    black and green products are shown. There will be a large number of choices
    that a user can make so I'm wondering...

    can I right a bit of code or function and put in a seperate module to call
    from an after update event of an option group? I"m not real familiar with
    using modules or code outside of an objects events.

    What I'm thinking is a user clicks the check box for "Black" and the
    afterupdate would call function filterResults which could contain code that
    would run the list of options, If Black = true then show black products,
    else don't show them; if Red = true then...

    Does this make sense/ seem like it would be the best way to do it?


  • Salad

    #2
    Re: Continuous filtering with a module?

    Kevin wrote:
    I want to use a set of check boxes to narrow down entries on a subform. I.e.
    a check box for black, red & green to describe the colors of a product. So a
    use clicks Black and only black products are shown, the click green and only
    black and green products are shown. There will be a large number of choices
    that a user can make so I'm wondering...
    >
    can I right a bit of code or function and put in a seperate module to call
    from an after update event of an option group? I"m not real familiar with
    using modules or code outside of an objects events.
    >
    What I'm thinking is a user clicks the check box for "Black" and the
    afterupdate would call function filterResults which could contain code that
    would run the list of options, If Black = true then show black products,
    else don't show them; if Red = true then...
    >
    Does this make sense/ seem like it would be the best way to do it?
    >
    >
    This is an off the cuff idea.

    I might make a list of colors as a list of values or derived from a
    lookup table. I would then have some columns for the color, products,
    models, etc in the main (sub) form. Those columns in the form I'd set
    to Enabled/Yes, Locked/Yes. This makes them available to see but not
    modifiable.

    I'd then create a new form that has a list of colors in a combo, the
    products, models, costs, and whatever columns are required in the main
    form's display. You could have a field in the form called SelectCancel.
    And two command buttons...Selec t and Cancel. In the Select buttons
    OnClick event something like
    SelectCancel = True
    Me.Visible = False
    For the Cancel
    SelectCancel = False
    Me.Visible = False
    The color combo in this form

    Now in any of those columns in the main form; color, product, etc, put
    in the OnDblClick and event to open the form in dialog mode.
    Docmd.Openform "ColorProductSe lect",,,,,acDia log
    If Forms!ColorProd uctSelect!Selec tCancel then
    Me.Color = Forms!ColorProd uctSelect!Color
    Me.Product = Forms!ColorProd uctSelect!Produ ct
    etc
    Endif
    'now close the form
    Docmd.Close acForm, "ColorProductSe lect"

    When the form "ColorProductSe lect" is opened, you can grab data from the
    main/sub form. Like
    Me.Color = Forms!MainFormN ame!SubformName !Color
    Me.Product = Forms!MainFormN ame!SubformName !Product

    With this method you use another form to feed information to your main
    form...and visa versa. Editting and modifying data is done in
    "ColorProductSe lect" and display of data is in the main/sub form.

    Lonely Heart


    Comment

    • Kevin

      #3
      Re: Continuous filtering with a module?

      After re-reading my post this afternoon, I had trouble understanding what I
      was asking so let me try to elaborate & clarify!

      My table contains a list of products. Each product is described through a
      series of yes/no fields which we will call featureA, featureB, etc. The form
      has/will have a check box for each of the yes/no fields, ckFeatureA,
      ckFeatureB, etc. and a subform which will contain the list of products. The
      user will click a checkbox, say ckFeatureA and I want the subform to show
      all products where featureA is true. Then the user will check another box,
      say ckFeatureB (ckFeatureA is still checked) and the subform will now show
      all products where featureA is true and featureB is true. Now if the user
      unchecks ckFeatureA, the subform will show all products where featureB is
      true only.

      The more I have looked at this issue, I am more unsure of how to procede (or
      start really, since I'm just spinning my wheels here). It seems that I
      somehow need to write a function that would create a query or filter on the
      fly and put it in a module so that I could call it from each of the checkbox
      afterUpdate events.


      "Kevin" <none@email.com wrote in message
      news:%Kfwj.2958 56$1x.129925@fe 05.news.easynew s.com...
      >I want to use a set of check boxes to narrow down entries on a subform.
      >I.e. a check box for black, red & green to describe the colors of a
      >product. So a use clicks Black and only black products are shown, the click
      >green and only black and green products are shown. There will be a large
      >number of choices that a user can make so I'm wondering...
      >
      can I right a bit of code or function and put in a seperate module to call
      from an after update event of an option group? I"m not real familiar with
      using modules or code outside of an objects events.
      >
      What I'm thinking is a user clicks the check box for "Black" and the
      afterupdate would call function filterResults which could contain code
      that would run the list of options, If Black = true then show black
      products, else don't show them; if Red = true then...
      >
      Does this make sense/ seem like it would be the best way to do it?
      >

      Comment

      Working...