Search Multiple Queries with One Entry

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

    #1

    Search Multiple Queries with One Entry

    I have a form that has 6 command buttons on it. Each command button
    runs a different query with a wildcard parameter value that looks in 6
    different tables in 6 different linked databases. None of the
    databases are joined or have anything in common. Right now the users
    have to key in the same lookup string for every button. Is there a way
    to have a text box on the form, where the user can key the wildcard
    text string and then click on the button and the query would return the
    results. Example: I am looking for IBM in each one of the databases.
    I would like to type IBM in the text box on the form, when click Search
    DBOne and search that database, when just click the next search button
    for DBTwo, without retyping IBM everytime. Help I have tryed
    everything and I just can't see to get it to work. I am so confused.
    Thanks.

  • pietlinden@hotmail.com

    #2
    Re: Search Multiple Queries with One Entry

    one way is to point the queries at the open form to collect the input.
    Say you have a textbox, called "txtCriteri on" and your form is called
    "frmSearch"

    Then you could modify your queries so they all look something like
    this:

    SELECT....
    FROM ...
    WHERE SomeField=Forms ![frmSearch]![txtCriterion]

    Then you could make all of the queries run in the click event of a
    single button...

    DoCmd.OpenQuery "qryMyQuery 1"
    DoCmd.OpenQuery "qryMyQuery 2"

    Comment

    • RoadRunner

      #3
      Re: Search Multiple Queries with One Entry

      Thank you so much. I finally got it to work. I have one question, if
      my users what the ability to but in partial names, where would I use
      the wildcard?

      Thanks

      pietlinden@hotm ail.com wrote:[color=blue]
      > one way is to point the queries at the open form to collect the input.
      > Say you have a textbox, called "txtCriteri on" and your form is called
      > "frmSearch"
      >
      > Then you could modify your queries so they all look something like
      > this:
      >
      > SELECT....
      > FROM ...
      > WHERE SomeField=Forms ![frmSearch]![txtCriterion]
      >
      > Then you could make all of the queries run in the click event of a
      > single button...
      >
      > DoCmd.OpenQuery "qryMyQuery 1"
      > DoCmd.OpenQuery "qryMyQuery 2"[/color]

      Comment

      • Jeemo
        New Member
        • May 2006
        • 6

        #4
        Originally posted by RoadRunner
        Thank you so much. I finally got it to work. I have one question, if
        my users what the ability to but in partial names, where would I use
        the wildcard?

        Thanks

        pietlinden@hotm ail.com wrote:[color=blue]
        > one way is to point the queries at the open form to collect the input.
        > Say you have a textbox, called "txtCriteri on" and your form is called
        > "frmSearch"
        >
        > Then you could modify your queries so they all look something like
        > this:
        >
        > SELECT....
        > FROM ...
        > WHERE SomeField=Forms ![frmSearch]![txtCriterion]
        >
        > Then you could make all of the queries run in the click event of a
        > single button...
        >
        > DoCmd.OpenQuery "qryMyQuery 1"
        > DoCmd.OpenQuery "qryMyQuery 2"[/color]
        Try this:

        SELECT...
        FROM...
        WHERE SomeField LIKE Forms![frmSearch]![txtCriterion] & "*"

        Comment

        Working...