Can you please try this amended code (choose the line you need for the criteria based on the data type of the complaint number)? You need to isolate the form variable otherwise it is passed as the literal text
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]![ComplaintDetails - 2021]![ComplaintNumber] 'assumes complaint number is numeric
'criteria = "[ComplaintNumber]= '" & [Forms]![ComplaintDetails - 2021]![ComplaintNumber] & "'" 'assumes complaint number is text
strfolder = "F:\Documents"
strfilename = Me.ComplaintLastName & Me.ComplaintFirstName & "-" & Day(Now) & "-" & Month(Now) & "-" & Year(Now) & ".pdf"
DoCmd.OpenReport reportName, acViewPreview, criteria, acHidden
DoCmd.OutputTo acOutputReport, reportName, acFormatPDF, strfolder & strfilename
DoCmd.Close acReport, reportName, acSaveNo
End Sub
Cheers,