I have a form that searches all Vendor payments and the subform produces all the payments to that vendor. I have created a report that prints the results by clicking "Print Report" button. I would like to clear the data on the form when I open that report. Attached is the code that opens the report but I can't get it to clear the data.
When I exit that form and reopen it, It still has my last search information in the subform. I've tried "on close" me.requery on the Parent form but it still contains data when I open it again.
Any help would be appreciated.
When I exit that form and reopen it, It still has my last search information in the subform. I've tried "on close" me.requery on the Parent form but it still contains data when I open it again.
Any help would be appreciated.
Code:
Private Sub btnVendorReport_Click()
Dim strFilter As String
If Not IsNull(Me!DemoClientID) Then
strFilter = "DemoClientID = " & Me!DemoClientID
If Me.FilterOn And InStr(Me.Filter, strFilter) > 0 Then
DoCmd.OpenReport "rptVendorPayment", acViewPreview, , strFilter
Else
DoCmd.OpenReport "rptVendorPayment", acViewPreview, , strFilter
End If
Else
MsgBox "DemoClientID is not selected.", vbExclamation
End If
Exit_cmdCurrent_Click:
Exit Sub
Err_cmdCurrent_Click:
MsgBox "Error: " & Err.Description, vbCritical
Resume Exit_cmdCurrent_Click
Dim ctl As Control
For Each ctl In Me.Controls
If ctl.ControlType = acTextBox Then
ctl.value = Null
End If
Next ctl
Set ctl = Nothing
End Sub