I have a Browse procedure that I want to filter based on an empty Date field.
There is Boolean variable set to 0 at window opening and a Button to apply or remove the filter.
The following code is placed in ThisWindow.TakeAccepted procedure.
Apparently "empty" Date fields default to 1/1/0001. I have tried several filters with and without the Year() function, including 0, < various numbers, and Not.
No compile errors occur. Usually clicking the filter button has no effect, occasionally I get a run-time error about inability to apply an invalid filter.
Any advice as to what to do differently will be much appreciated. TIA
! Start of "Control Event Handling, after generated code"
! [Priority 5000]
If Filtered = 0
BRW1.SetFilter('Year(Lns:DateReturned) = 1')
BRW1.ApplyFilter
Filtered = 1
ElsIf Filtered = 1
BRW1.SetFilter('')
BRW1.ApplyFilter
Filtered = 0
End
ThisWindow.Update()
! End of "Control Event Handling, after generated code"
! End of "Control Event Handling"