I see a couple of issues:
Code:
Private Sub cmd_exportformPDF_Click()
Dim reportName As String
Dim criteria As String
Dim strfolder As String
Dim strfilename As String
reportName = "CompletedForm"
criteria = "[ComplaintNumber]= " & [Forms]![frm2021Details]![ComplaintNumber]
strfolder = "F:\Documents" '<<-- missing backslash
strfilename = Me.CustomerLastName & ", " & Me.CustomerFirstName & " " & Format(Me.DateOpened, "m.d.yyyy") & ".pdf" '<<-- Not a good idea having a comma in the file name. Also shouldn't have multiple periods in file name
DoCmd.OpenReport reportName, acViewPreview, criteria, acHidden
DoCmd.OutputTo acOutputReport, reportName, acFormatRTF, strfolder & strfilename ' <<-- it looks like you are using the report unfiltered by having "reportName" in the objectname parameter
DoCmd.Close acReport, reportName, acSaveNo
End Sub
Consider:
Code:
Private Sub cmd_exportformPDF_Click()
Dim reportName As String
Dim criteria As String
Dim strfolder As String
Dim strfilename As String
reportName = "CompletedForm"
criteria = "[ComplaintNumber]= " & [Forms]![frm2021Details]![ComplaintNumber]
strfolder = "F:\Documents\" '<<-- added backslash
strfilename = strfolder & Me.CustomerLastName & "_" & Me.CustomerFirstName & "_" & Format(Me.DateOpened, "m_d_yyyy") & ".rtf"
Debug.Print strfilename
DoCmd.OpenReport reportName, acViewPreview, criteria, acHidden
DoCmd.OutputTo acOutputReport, , acFormatRTF, strfilename ' <<-- Notice no objectname (see below)
DoCmd.Close acReport, reportName ' , acSaveNo means save changes to DESIGN changes - it is not needed when you close the report
End Sub