I have a main form that filters a subform and I have a button that creates a report from the filtered data. All works great except for when I clear the filters. The subform clears and shows that it is unfiltered, but when i click the button to create the report, it only shows the data from when it was last filtered. This leads me to believe the Clear button works, and it is an issue with the Report button. The code is below. Any suggestions, would be appreciated.
Code:
Private Sub cmdClear_Click()
Me!cbosalesperson = Null
Me!cboVendor = Null
Me!cboRetailer = Null
Me!cboPaid = Null
On Error GoTo cmdclear_click_err
Me.PurchaseOrderssub.Form.FilterOn = False
cmdclear_click_exit:
Exit Sub
cmdclear_click_err:
MsgBox Error$
Resume cmdclear_click_exit
End Sub
Private Sub cmdReport_Click()
On Error GoTo cmdReport_Click_Err
Dim strfilter As String
strfilter = Me.PurchaseOrderssub.Form.[Filter]
If strfilter <> "" Then
DoCmd.OpenReport "rptPurchaseOrders", acViewPreview, , strfilter
DoCmd.SendObject acReport, "rptPurchaseOrders", acFormatXLS, "", "", "", "", "", True, ""
Else
DoCmd.OpenReport "rptPurchaseOrders", acViewPreview
cmdReport_Click_Exit:
Exit Sub
cmdReport_Click_Err:
MsgBox Error$
Resume cmdReport_Click_Exit
End If
End Sub