gojets1721
Registered User.
- Local time
- Today, 06:07
- Joined
- Jun 11, 2019
- Messages
- 430
Okay that worked...last issue (I'm sorry). It doesn't seem to be applying the criteria. When I export, it's exporting every entry in the form to PDF when it should be exporting only one. Anything visible from the code that would cause the criteria to not be applied? Here's the code:
Code:
Private Sub btnExportEvent_Click()
Dim reportName As String
Dim criteria As String
Dim fd As Object
Dim filename As String
reportName = "CompletedForm"
criteria = "[ComplaintNumber]= " & [Forms]![frmDetails]![ComplaintNumber]
Set fd = Application.FileDialog(2)
filename = Me.CustomerLastName & ", " & Me.CustomerFirstName & " " & Format(Me.DateOpened, "m.d.yyyy") & ".pdf"
With fd
.InitialFileName = "C:\Users\Public\" & filename
.Show
End With
MsgBox filename
DoCmd.OpenReport reportName, acViewPreview, criteria, acHidden
DoCmd.OutputTo acOutputReport, reportName, acFormatPDF, filename
DoCmd.Close acReport, reportName, acSaveNo
End Sub