change selectioncriteria of query

  • Thread starter Thread starter pilot
  • Start date Start date
P

pilot

Guest
I have a form with a button. And when I push it I want to set a criteria to the query and then open a report of the outcome of the query so I can print it.

So:
a button on a form
when I click it I want a criteria from a textbox put into a query field
and then a report of that query.

The whole issue is that I want to make a report of the current form what I just filled in.
 
Create a query where the criteria for the relevent field is =[Forms]![MyFormName]![MyFormtxtBoxName]

The query will now show whatever has been entered into the textbox. Now create a report based on the query.

For the button you just need to open the report and it should automaticaly select the criteria so:

DoCmd.OpenReport "ReportName", {SelectViewType}

HTH
 

Users who are viewing this thread

Back
Top Bottom