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

How to pass the parameter for the report?

Status
Not open for further replies.

sabavno

Programmer
Jul 25, 2002
381
CA
I want to be able to send the report to the text file.
But I also want to be able to pass the parameter for that report.
So now I just have this line of code,

DoCmd.OutputTo acOutputReport, "rptSomeReport", acFormatTXT, "c:\Files\SomeReport.txt"

How would I control the criteria for that report. Say I only want the records where the recordID < 100 to be sent to the file.

Please help
 
Is your report based on a query? If so, set the query criteria for field 'recordID' to <100. -illini
 
Or you could use DoCmd.ApplyFilter, regardless of whether or not the report is based on a query.
 
Or you could have a look at my faq:faq701-1964 called &quot;How TO Open A Parameter Query/Report From Code&quot;

B ----------------------------------------
Ben O'Hara
----------------------------------------
 
If your report is based on a query, you can set a filter for the query at runtime. I have included a sample of my code where I have asked the user for a value to my variable by means of an input box. Then set the field in the query to equal your input box response variable.

intBANum = InputBox(&quot;What is your Business Area ID? .&quot;, &quot;Business Area Request&quot;)

DoCmd.OpenReport rptTacticDetails, acPreview, &quot;qryTacticDetails&quot;, &quot;BusinessArea_ID = &quot; & intBANum & &quot;&quot;

Hope this helps
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top