Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pass variable to query

Status
Not open for further replies.

Shift838

IS-IT--Management
Jan 27, 2003
987
US
I am designing a form to run a report which calls a query. I want to be able to input a text field on the form and have the variable transferred to the query. Such as:

Text field will be ID Name, and I want to transfer this text field to find matches with the query. How can I do this?
 
Hi
In the criteria of the query, under the ID Name column:
=Forms!MyFormName!MyTextBox
 
I inputed for criteria:

=Forms!frmReport!text4

And the filter brings back no mathces at all now.
 
That's probably because there are no matches. Try press Ctrl+G to open the debug window. Then enter
? Forms!frmReport!text4
and press enter. Do you see what you expect? Is the form open?

BTW: rename your text4 to something that makes sense.

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
let me refrase, I want to use the text4 text box as a wild card so if I put in GID it will return all results that contat GID in the IDName.
 
Use
Like "*" & Forms!frmReport!txtFindIDName & "*"

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
well what I really need to do is take the text4 (which will be renamed) and take the text and pass it to the query as a variable so that if I put in GID then it will return all ID's with GID so if it contains it, not = to it..
 
Did you read my reply from 14:16?

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top