Roporttopdf and email

Lanser

Registered User.
Local time
Today, 15:50
Joined
Apr 5, 2010
Messages
60
Hi All,
I'm using A2003 and using Lebans excellent code I have managed to get as far as creating a pdf from a report and emailing it, but I am trying to give each one a unique name based on a field in the report
This is my current code
Code:
Dim strFilter As String
            strDocName = "Issue"
            strFilter = "Id = Forms!Issues!ID"
 
            DoCmd.OpenReport strDocName, acPreview, , strFilter
 
 
Dim blRet As Boolean
blRet = ConvertReportToPDF("Issue", , "T:\Issues\Issue" & ".pdf", False, False)
       SendMessage True, "T:\Issues\Issue.pdf"
 
        DoCmd.Close acReport, "Issue"


I have tried variations like this
Code:
blRet = ConvertReportToPDF("Issue", , "T:\Issues\Issue" & strFilter & ".pdf", False, False)
 
SendMessage True, "T:\Issues\Issue[strFilter].pdf"
 
        DoCmd.Close acReport, "Issue"

but that just gives me a filename of IssueId = Forms!Issues!ID how do I make it give me the actual Id to save it then be able to add to the sendmessage code?
 
Probably more like:

Code:
blRet = ConvertReportToPDF("Issue", , "T:\Issues\Issue" & Forms!Issues!ID & ".pdf", False, False)
 
SendMessage True, "T:\Issues\Issue" & Forms!Issues!ID & ".pdf"
 
        DoCmd.Close acReport, "Issue"


hth
Chris
 
Excellent works perfectly, thanks
 
Follow up question I decided to try and make each save unique by doing this to add the time to the filename using a field on the form called Time but it just saves as Issue2Forms!Issues!Time.pdf

Code:
blRet = ConvertReportToPDF("Issue", , "T:\Issues\Issue" & Forms!Issues!ID & Forms!Issues!Time & ".pdf", False, False)
 

Users who are viewing this thread

Back
Top Bottom