Getting Closer - Sort of

  • Thread starter Thread starter dhstein
  • Start date Start date
D

dhstein

I have a button set up - when I click the button it runs a Query. However
the Query has a hard coded value. So I have a text box and I can figure out
which event to use for the text box. But I need to understand how to read
the data in the text box (a 4-digit text string) into a variable and then how
to pass that variable to the Query so that we can query based on the number
entered in the text box. Any help would be appreciated - if you know of a
sample somewhere on the web that would be great also. Thanks.
 
hi,
But I need to understand how to read
the data in the text box (a 4-digit text string) into a variable and then how
to pass that variable to the Query so that we can query based on the number
entered in the text box. Any help would be appreciated - if you know of a
sample somewhere on the web that would be great also. Thanks.
The easiest way: Instead of hardcoding the value in your query, use a
reference like Forms![yourFormsName]![yourTextBoxsName] in the query.
This requires that the form is loaded while executing the query.



mfG
--> stefan <--
 
Suppose you have a form named frmMyForm with a text box named
txtMyValue that you want to use as criteria for your query. In the criteria
row of the relevant field in the query you would put;

Forms!frmMyForm!txtMyValue

As long as the form is open when the query is run, it will retrieve the
value from the text box.
 
Back
Top