How do you use a text box for the criteria in query?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • tomric
    New Member
    • Nov 2009
    • 31

    How do you use a text box for the criteria in query?

    I have a query that filters data and places the results in several text boxes on a form. I want to take the numbers in those txtboxes and use them as criteria for a different query. How do you take data from a txt box and use it as criteria in a second query?
  • TheSmileyCoder
    Recognized Expert Moderator Top Contributor
    • Dec 2009
    • 2322

    #2
    Start up your query editor, include the fields you want to include. Go to the line saying criteria, on the field you wish to query by, Right click and select Build, then Forms, Find your form, find the textbox (You did give it a sensible name right?)
    Click the far right where it should now say <Value>, and in the top view of the expression builder you should now see "Forms![frm_Comments]![tb_Comment] "
    Where frm_Comments is the name of my form, and tb_Comment is the name of my textbox within that form.

    Note that for such a query to run, the form MUST be open.

    Comment

    • tomric
      New Member
      • Nov 2009
      • 31

      #3
      Thank you very much, I got the thing working.

      Comment

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

        #4
        Thats nice to hear. Thank you for taking the time to return and reply.

        Comment

        Working...