Copy report name and combine with field data

  • Thread starter Thread starter Ed
  • Start date Start date
E

Ed

Hi all: using access 2002. Hope someone can point me in right direction for
this.
I would like to create in a macro line (that previews a report) a command
that will copy to clipboard (ready for pasting) the name of the report to be
opened combined with the report id. for example: "Proposal 152" where
proposal is name of report and 152 is the id or field data on form. The
intent is to set this up so it can be pasted into the file name when saving
a pdf report file.
Thanks, Ed
 
Ed,

I don't know how to do exactly what you ask, although I'm sure that it
is possible.

However, here's how I do this... I set up my PDF printer to output to a
default path/filename. So then I just use code to print the report, and
then after that to rename the file to the apppropriate specific file
name. Here's an example of such code, which may be of use to you...

Dim strReport As String
Dim strRptID As String
Dim DefaultPath As String
Dim DefaultFile As String
DefaultPath = "D:\Output\"
DefaultFile = "my.pdf"
strReport = "Proposal"
strRptID = Format(Me.Report_ID)
DoCmd.OpenReport strReport, , , "[Report ID]=" & Me.Report_ID
Name DefaultPath & DefaultFile As DefaultPath & strReport & strRptID &
".pdf"

This assumes that the PDF driver is the default printer for this report.
If it's not, you may also need to make provision for this.
 
Back
Top