Is it possible to open a search from from another form, pre-filtering the data...

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Rebecca McCallan
    New Member
    • Aug 2010
    • 38

    Is it possible to open a search from from another form, pre-filtering the data...

    *above I meant to say 'search form, from'
    I am wondering if it is possible to open a search form from another form (onclick of any record in a text box), pre-filtering the data in the search to relate to the originally clicked record... ie.
    At the moment I am implementing a code library, the two main forms are frm001_CodeSear ch which enables the user to filter what code they can see. The second is frm002_Categori es which consists of categories which the different code samples come under. On the click of a category I want frm001_CodeSear ch to open and be pre-filtered, showing only code under that category.

    Is this possible?

    Any replies and pointers in the right direction are appreciated!

    Cheers,
    Rebecca
  • Oralloy
    Recognized Expert Contributor
    • Jun 2010
    • 988

    #2
    Yes, it is.

    Open the form, and then set the [Record Source] or [Filter] attribute.

    Comment

    • Rebecca McCallan
      New Member
      • Aug 2010
      • 38

      #3
      frm002 already has a record source, as does frm001
      Which form should the filter attribute be set on and what to exactly?

      Thanks for the reply

      Rebecca

      Comment

      • TheSmileyCoder
        Recognized Expert Moderator Top Contributor
        • Dec 2009
        • 2322

        #4
        Hi Rebecca.
        Assumming that each code is assigned to a category by a field ID_Category and that field is a number field you could do such:

        Code:
        docmd.openform "frm001_CodeSearch ",,,"ID_Category=" & me.tb_Category
        where tb_Category shall be a textbox (or combobox) on your frm_002, containing the ID_Category.

        I dont know your level of code expertise, so if you require more assistance, please feel free to ask for it.

        Comment

        • Rebecca McCallan
          New Member
          • Aug 2010
          • 38

          #5
          Thanks for your help but I've managed to do it in a different way now, by controlling the filter on the other form instead.

          Thanks anyway!

          Rebecca

          Comment

          • Oralloy
            Recognized Expert Contributor
            • Jun 2010
            • 988

            #6
            Just got in and I saw the continued thread.

            Glad you figured it out, Rebecca.

            Cheers!

            Comment

            Working...