MyFilename = "forms![frmGC]!CompanyName" & "-" & "Forms![frmEditproject]!ProjectName" & ".pdf"
I'm trying to auto-generate a file name, I seem to be doing the wrong format,
I want to pull from frmGC!CompanyName and frmEditProject!Projectname
i'm trying to get a sample report printed out to a .PDF.
The full line of code is this :
Private Sub btnEmail_Click()
Dim MyFilter As String
Dim MyPath As String
Dim MyFilename As String
MyFilter = "[ProjectKey]=Forms![subProjectinfo Edit]!projectkey"
MyPath = "C:\PDF\"
MyFilename = "forms![frmGC]!CompanyName" & "-" & "Forms![frmEditproject]!ProjectName" & ".pdf"
DoCmd.OpenReport "Report-Custom", acViewPreview, , MyFilter
DoCmd.OutputTo acOutputReport, "", acFormatPDF, MyPath & MyFilename, True
'Let's close our previewed report
DoCmd.Close acReport, "Report-Custom"
End Sub
Does anyone have any suggestions on a good script to email this PDF to a customer's email address without opening Outlook?
I'm trying to auto-generate a file name, I seem to be doing the wrong format,
I want to pull from frmGC!CompanyName and frmEditProject!Projectname
i'm trying to get a sample report printed out to a .PDF.
The full line of code is this :
Private Sub btnEmail_Click()
Dim MyFilter As String
Dim MyPath As String
Dim MyFilename As String
MyFilter = "[ProjectKey]=Forms![subProjectinfo Edit]!projectkey"
MyPath = "C:\PDF\"
MyFilename = "forms![frmGC]!CompanyName" & "-" & "Forms![frmEditproject]!ProjectName" & ".pdf"
DoCmd.OpenReport "Report-Custom", acViewPreview, , MyFilter
DoCmd.OutputTo acOutputReport, "", acFormatPDF, MyPath & MyFilename, True
'Let's close our previewed report
DoCmd.Close acReport, "Report-Custom"
End Sub
Does anyone have any suggestions on a good script to email this PDF to a customer's email address without opening Outlook?