referencing a form control to perform query

p5x

Registered User.
Local time
Today, 16:25
Joined
Mar 2, 2003
Messages
16
How do you use the value written in a control of a form as input for a query?

eg-if the user inputs 100 into an itemid text box on a form, i want to use 100 as input for a query.

I thought it was:

Forms![name of form]![name of control on form]

but Access automatically puts brackets around [forms] and then it comes up with a parameter query msg box with the caption: forms!name of form!name of control.

What am i doing wrong?
 
Are you using the reference in the criteria section? If so open the main form in design view and use the code builder to get the correct references
 
How do you use the code builder to get the reference?
I've been right clicking the appropriate control and choosing properties>Other tab, and the "name" property as the field name.

is that right?
 
Open the query and form in design view, click in the criteria cell of the query grid, click the build button on the toolbar, you'll have to select the form and control from the list of objects displayed, once they're correct click paste and close the window
 

Users who are viewing this thread

Back
Top Bottom