P
Programmer - wannaB
Someone could please tell me why I need “On Error Resume Next†in this code.
I tried for hours to find the right line to set the filter of these
sus-reports, and kept getting different error messages, then I looked at the
form properties and noticed that the filter was what I was looking for and it
was getting set by the code, even though it would error out. Is there better
code I should be using or is this just one of those things????
Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
On Error Resume Next
If Year(Me.rFP10!FHDate) < Year(Now()) Then
Me.rFP11.Report.FilterOn = True
Me.rFP11.Report.Filter = "year(FHDate)=(Year(Now()) -2)"
Me.rFP12.Report.FilterOn = True
Me.rFP12.Report.Filter = "year(FHDate)=(Year(Now()) -3)"
Me.rFP13.Report.FilterOn = True
Me.rFP13.Report.Filter = "year(FHDate)=(Year(Now()) -4)"
Me.rFP14.Report.FilterOn = True
Me.rFP14.Report.Filter = "year(FHDate)=(Year(Now()) -5)"
End If
End Sub
I tried for hours to find the right line to set the filter of these
sus-reports, and kept getting different error messages, then I looked at the
form properties and noticed that the filter was what I was looking for and it
was getting set by the code, even though it would error out. Is there better
code I should be using or is this just one of those things????
Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
On Error Resume Next
If Year(Me.rFP10!FHDate) < Year(Now()) Then
Me.rFP11.Report.FilterOn = True
Me.rFP11.Report.Filter = "year(FHDate)=(Year(Now()) -2)"
Me.rFP12.Report.FilterOn = True
Me.rFP12.Report.Filter = "year(FHDate)=(Year(Now()) -3)"
Me.rFP13.Report.FilterOn = True
Me.rFP13.Report.Filter = "year(FHDate)=(Year(Now()) -4)"
Me.rFP14.Report.FilterOn = True
Me.rFP14.Report.Filter = "year(FHDate)=(Year(Now()) -5)"
End If
End Sub