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

Using Controls on a Form to Specify Criteria For a Report 1

Status
Not open for further replies.

zp162002

Programmer
Feb 3, 2003
39
US
I would like to use a form to allow a user to specify the criteria to be used to print a report. This report is based on a query. I would like to use text boxes on the form. The text boxes will not always be populated depending on the information the user chooses to enter. Does anyone have any examples on how this can be done?
 
You can add your form inputs to your query. Add the sample code to your queries Criteria field:
=[Forms]![yourformname]![textboxnameonform]

If all of your forms inputs are not required, you should change your WHERE clause in your query to OR. Below is a sample:

SELECT Table1.*, Table1.field1, Table1.field2
FROM Table1
WHERE (((Table1.field1)=[Forms]![yourformname]![text1])) OR (((Table1.field2)=[Forms]![yourformname]![text2]));

Hope this helps.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top