Ozzboss
New member
- Local time
- Today, 22:41
- Joined
- Mar 11, 2022
- Messages
- 19
So much help with the last question so I'll try my luck again lol.
I have created a button on my form and used the following code to save a quote as a PDF and name it "[QuoteNumber].PDF" (6001.PDF)
Now I am trying to create a button to email a PDF to the client. Everything is auto-completed and works just fine EXCEPT for the name of the PDF.
It currently attaches to the email as
I have added the Dim and string for the FileName but I can't figure out how to add it to the correct line (OutputFormat:=acFormatPDF, _)

I have created a button on my form and used the following code to save a quote as a PDF and name it "[QuoteNumber].PDF" (6001.PDF)
Code:
Private Sub SaveTtoPDF_Click()
Dim strFileName As String
strFileName = Me.[QuoteNumber]
DoCmd.OutputTo acOutputReport, "QuotePrintout", acFormatPDF, "C:\Users\roomeatsmash\Desktop\" & FileName & ".PDF"
End Sub
Now I am trying to create a button to email a PDF to the client. Everything is auto-completed and works just fine EXCEPT for the name of the PDF.
It currently attaches to the email as
Code:
Private Sub PDFAndEmail_Click()
Dim strTo As String
Dim strSubject As String
Dim strMessageText As String
Dim strFileName As String
Me.Dirty = False
strFileName = Me.[QuoteNumber]
strTo = Me.ClientEmail
strSubject = "Southside Bitumen Driveways Quotation Number " & Me.QuoteNumber
strMessageText = Me.ClientName & ":" & _
vbNewLine & vbNewLine & _
"Please find attached quotation for your approval." & _
vbNewLine & vbNewLine & _
"If you have any questions please feel free to contact me by return email or by calling 0404 040 404." & _
vbNewLine & vbNewLine & _
"If everything is correct and you wish to proceed, please complete the bottom of BOTH pages and return to us by email" & _
vbNewLine & vbNewLine & _
vbNewLine & vbNewLine & _
"Thanking You" & _
vbNewLine & vbNewLine & _
"Troy Rankine" & _
vbNewLine & vbNewLine & _
"Southside Bitumen Driveways"
DoCmd.SendObject ObjectType:=acSendReport, _
ObjectName:="QuotePrintout", _
OutputFormat:=acFormatPDF, _
To:=strTo, _
Subject:=strSubject, _
MESSAGETEXT:=strMessageText, _
EditMessage:=True
End Sub
I have added the Dim and string for the FileName but I can't figure out how to add it to the correct line (OutputFormat:=acFormatPDF, _)
