Full Version: Name A Report Based Upon The Job Number
UtterAccess Discussion Forums > Microsoft® Access > Access Reports
Aquadevel

Hi My 'Utter Friends,

Ok, I need some help with a Access report. I need to have the report named based upon the JobID number in the record.

So for a report for JobID = 9012, the report would be named 9012, etc.

I've never had to do this before.

Any Ideas??

Thanks,

uarulez2.gif
DanielPineault
When it is saved as a PDF? Something else?
Aquadevel

Opps, yea, as a PDF. the actual Access report will probably never be used.

Thanks,
DanielPineault
Can you not simply use:

CODE
DoCmd.OutputTo acOutputReport, "YourReportName", acFormatPDF, FileNameToGiveExportedFile


So in your case build a variable based on your JobId to use as the filename

CODE
sPath = "<A href="file://\server......."">\\server\...\....\"
sFilename = Me.JobID
sFile = sPath & sFilename & ".pdf"
DoCmd.OutputTo acOutputReport, "YourReportName", acFormatPDF, sFile
Aquadevel

Hi Daniel,

I'm using Leban's Report2PDF and not using A2007 method.

So, by using the following I get the result of the PDF being named as the JobID:


CODE
[/code]
Dim strwhere As String
Dim blRet as Boolean
strwhere = "[JobID] = " & Me.[JobID]
blret = ConvertReportToPDF("rptoilfield_workorder", vbNullString, "c:\KilgoreoilfieldPDFs\" & strwhere & ".pdf", False, False)
[code]


Thanks,
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.