How to apply a filter to a browse for an empty date

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"

Perhaps I should mention that the Browse has only one key.

What driver? What database?

First I notice is Year=1, can't happen, not after Christ's crusification

Next: setfilter has a second name parameter. Without using that, resetsort will apply standard filters.

Setfilter applies to current sort order, you will need to add a new sort order to replace existing criterias. I might be remembering wrong, but there might be some wildcard filtername you can use to replace, consult the docs on setfilter.

This is a TPS File; not SQL. All files in Application are TPS.
And just in case: Clarion 12; ABC.template chain

And what is the Key and its field elements?

Using a Key where its field elements are used in a filter, will speed up the filter process.

If the key does not have the field elements that are used in a filter, the filter will take longer to go through the TPS file.

I suspect the date display defaults to 1/1/0001 - not the value in your data table??

Have a look at the table with Topscan and see what is in there.

Not sure exactly what you want, but with TPS data you can usually get away with either of the below in the FIlter statement...

'Lns:DateReturned'

Or

'NOT Lns:DateReturned'

i.e. the value is not empty, or empty.

I would use a Date Range

DateBegin LONG
DateEnd LONG

IF FilterDate THEN
   DateBegin = DATE(1,1, YEAR( FilterDate ) )
   DateEnd  = DATE(12,1, YEAR( FilterDate ) )
ELSE
   DateBegin = 0
   DateEnd  = 9999999
END

BRW1.SetFilter('Lns:DateReturned >= DateBegin AND Lns:DateReturned <= DateEnd')

Thanks for everyone's help; the filter is now working.
Geoff's suggestion of 'NOT Lns:DateReturned' was the answer. I really don't know why I had not thought of that myself.
Also, Bjarne mentioned resetsort. I had neglected that, and it was needed.