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

Changing a report's caption property w/o opening it

Status
Not open for further replies.

MikeAngelastro

Programmer
Mar 2, 2000
26
0
0
US
Hi,<br><br>I need to be able to run a report multiple times.&nbsp;&nbsp;However, I need to have a different caption each time I run it.&nbsp;&nbsp;How do you change the caption property of a report with code without opening it.&nbsp;&nbsp;<br><br>The helper suggests that a report is in the documents collection until it is opened, at which time it becomes a member of the reports collection.&nbsp;&nbsp;It's all very very confusing when all I want to do is change the value of a property.&nbsp;&nbsp;The code below does not work:<br><br> REPORTS![rptReportName].Cation = &quot;Something&quot; <br><br>unless the report is running.&nbsp;&nbsp;It's seems more complicated them I think it should be.<br><br>Any help?<br><br>Mike<br>
 
so, if you're running the report multiple times, why can't you have the report open to change the value.<br>i don't believe there is a way to change the value without it being open in one form or another (Design, Normal, or Preview).<br><br>plus, why do you care to change the Caption? do you just want a different header depending on the info?&nbsp;&nbsp;you could do this by making an unbound textbox, with a somewhat complicated IIf statement, or put the If...Then statement in the OnOpen property of the report. <p>Brian Famous<br><a href=mailto:bfamous@ncdoi.net>bfamous@ncdoi.net</a><br><a href= > </a><br>
 
Are you putting the above code in the Print event? Also I noticed you misspelled caption in your code sample above. Did you do that in the actual code?
 
Hi Brian and Cornerstone,<br><br>First, I did not misspell &quot;caption&quot; in the code - only in the message.<br><br>Second, here is my grand scheme:<br><br>I am running a report that runs for any of a number of countries.&nbsp;&nbsp;My objective it to print the reports to Adobe Acrobat Distiller.&nbsp;&nbsp;This creates a PDF file in Acrobat's PDF directory.&nbsp;&nbsp;The name Acrobat uses for the file is the caption.&nbsp;&nbsp;I want to have a report saved there for each country.&nbsp;&nbsp;I have to change the caption to keep the second report from overwriting the first, and so on.&nbsp;&nbsp;My thought was to read through the country table with DAO and for each record change the report's caption, generate the country's report, and save it as a PDF file.&nbsp;&nbsp;When this process is complete, I will the use the&nbsp;&nbsp;FileSystemObject to copy the PDFs to another folder that contains an HTML page with a link to each of the reports.&nbsp;&nbsp;When the user clicks a report's link, the PDF file for it will appear in the browser with the assistance of freely available Adobe Acrobat Reader. <br><br>The reason I am using Acrobat Distiller is because saving a report as HTML does not provide a very good result - especially when the report has columns going across the page.&nbsp;&nbsp;Charts don't even show up. In addition, PDF reports look very good. Basically, the reports are static and the data for them changes only once per month.<br><br>So what do you think?<br><br>Thanks,<br><br>Mike
 
For certain you cannot change the property without the report being opened in some fashion. <br><br>Why not open it in code set the caption and then do whatever else and then close it. Repeat for each record in the table?<br><br>For example<br><br>rst.movefirst<br>Do until rst.eof<br>docmd.openreport &quot;reportname&quot;, acViewDesign<br>reports![reportname].caption=rst!country<br>'other code<br>docmd.close acReport,&quot;reportname&quot;,acSaveNo <br>rst.movenext<br>Loop<br><br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top