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!

Saving Report using form fields as part of the name

Status
Not open for further replies.

teriwinkle

Technical User
Oct 29, 2003
7
US
I have a report generated by a dynamic query. I want to save the report using two fields, [NvrNumber] and [JobNo]. For example. I would like a report to be named "NvrReport_24_3000" where "24" is the [NvrNumber] field and "3000" is the [JobNo]field on the form. For the next report it ,might be "NvrReport_25_3001", or "NvrReport_25_3000", depending on the values of those two fields.


I open the report as follows, but how would I add a command to save the report so that it will save each report using those two fields, in the format above?


DoCmd.OpenReport "rptNvr_QBF", acPreview, , strWhere


Thank you for yoru help!

Teresa
 
You could use the OutputTo method instead of the OpenReport method. For example:
Code:
DoCmd.OutputTo acOutputReport, "rptNvr_QBF", acFormatRTF
, "NvrReport_" & [NvrNumber] & "_" & [JobNo]
This creates the report in rich-text format (RTF) with the name as you require. You can also add a fully-qualified path to the front of the name to put the report into a path other than the current path:
Code:
DoCmd.OutputTo acOutputReport, "rptNvr_QBF", acFormatRTF
, "C:\My Documents\NvrReport_" & [NvrNumber] & "_" & [JobNo]

[shadeshappy] Cruising the Information Superhighway
(your mileage may vary)
 
Thank you for your help! I especially like being able to save it where I want it. It works great!

Teresa
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top