Input a parameter into a Query on OpenReport

csprop

Registered User.
Local time
Today, 17:24
Joined
Jul 27, 2004
Messages
12
I have a form with a command button I use to print a report. The report I print gets its data from a query which requires a parameter. That parameter can be found in a field on the form.

How can I tell access to use that value as the parameter without the user having to enter it when I try to print the report?

Thanks.
 
change the criteria to reference the form and field
Forms!YourForm!YourField
 
Which criteria are you referring to?
 
form limits report

Utmost: You seem to have posted the same question several different ways in this forum. So let me explain what I have done that I think will solve your problem, and I will try to keep it simple.

First, I create a table called tblReport. I list on it the fields that all of the reports need to use, in your case StartDate and EndDate (and possibly group). I also give it some field for a unique key, like rptkey.

Next, I create a form, frmReport, where I use this table as the source. I then add buttons to run the particular reports. (Make sure to add a line to save the record first, DoCmd.Run Command acCmdSaveRecord.)

Now, if you can change the queries, then you can use Dlookup as the criteria for the date1 field, such as >= DLookup("[StartDate]","tblReport") and <= DLookup("[EndDate]","tblReport").

If you can't change the query, then another option is to run each report using a macro. In the macro, make sure to View Conditions. Now, you have to tell it the field to check. date1 >= DLookup("[StartDate]","tblReport") and date1 <= DLookup("[EndDate]","tblReport")

HTH
 
Well I eventually got the OK to take the parameters out of the queries. When I open the reports, I will add in the parameters in the WHERE clause of the report object. Thanks very much for your help anyhow.
 

Users who are viewing this thread

Back
Top Bottom