Hello,
I'm trying to create a macro that saves the current "visible" record of a form as a PDF. I'm not sure how to do this. I looked online and the best I could find was the following code.
Private Sub SaveToPDF(Totals As String)
On Error GoTo SaveToPDF_Err
'Totals = name of form the function was called from
'DestPath = Destination path for PDF file
Dim DestPath As String
'DestFile = Destination file name for PDF file
Dim DestFile As String
'ShowPdf = launch acrobat and display saved PDF file
Dim ShowPdf As Boolean
'Saves the file to specific folder
DestPath = "\\AHCDFS.AHC.UFL.EDU\FILES\DN\PERSONAL\stephenpaol ini\Desktop\Send Remediation"
'Formats the file name
DestFile = "\TabulaRasa"
ShowPdf = False
'DoCmd.OutputTo acOutputForm, , acFormatPDF "PDFFormat(*.pdf)", DestPath & DestFile & ".pdf", ShowPdf, "", 0, acExportQualityPrint
Dim strDestFile As String
strdesfile = DestPath & DestFile & ".pdf"
DoCmd.OutputTo acOutputForm, Totals, acFormatPDF, strdesfile, False
SaveToPDF_Exit:
Exit Sub
SaveToPDF_Err:
Resume SaveToPDF_Exit
End Sub
Unfortunately this code totally breaks my form when used. There is also no evidence that this is working either. I'm trying to use this function, in combination with an email macro, to be able to email a specific record of a form. For more context I'm trying to allow the user to email a student with certain qualities a copy of their record in the form. Luckily I don't have to email en masse so I thought I'd just continue to use the same file destination and over-write it if the user wants to send a different record as well.
I hope I am not being too confusing. I appreciate any help you can give.