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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing Form Parameter to Query

Status
Not open for further replies.

jbtman

Programmer
Jul 13, 2007
30
I have used some info found here to create a query that pulls its criteria from a form. In the query I specify [Forms]![FormName]!Control and the control is a textbox. But even though there is a value in the textbox it still prompts me for the value to use.

What is the correct syntax for this?

Thank!!
 
Is the form open when you run the query? Have you tried building the criteria by using the Expression Builder?
 
Yes, the form is open when I run the query but I have not tried the expression builder. I will give it a shot!
 
the correct syntax is:
... where forms!formName!controlName = someValue

check that you've spelt everything correctly and maybe post the sql for your query.

--------------------
Procrastinate Now!
 
What I am trying to do is

Where TableFieldName = Forms!FormName!Control.Value
 
There is nothing wrong with

[Forms]![FormName]!Control

As long as FormName and Control are the right names from the form and as long as the form is open. The Expression Builder should ensure that you are using the right names.
 
Just a note:
FormName must be an open mainform.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top