double check code? (1 Viewer)

Officeboy

Registered User.
Local time
Today, 03:23
Joined
Nov 10, 2009
Messages
66
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?
 

HiTechCoach

Well-known member
Local time
Today, 05:23
Joined
Mar 6, 2006
Messages
4,357
for the first issue try concatenating the value from the form reference, not the form reference like this :

Code:
MyFilename = forms![frmGC]!CompanyName & "-" & Forms![frmEditproject]!ProjectName & ".pdf"
 

Users who are viewing this thread

Top Bottom