I recently discovered a handful of machines on the network were running 2000 SR-1, and as such my database was not functioning correctly because of a bug with applying filters in that release, the details of which are given here:
In a nutshell, the bug means the filter works correctly the first time it is applied, but after that it always returns the same results. The workaround suggested on the above link involves emptying the filter before applying a new one.
My form gives users the option of filtering the records by 5 criteria, and although the above method does get around the problem for 4 of these, it fails to work on the 5th.
The only difference I can see is that for the 4 that work the criteria is straightforward, e.g. i have a text box that the user enters a post code in called txtPCode
Sub exactPCode_Click() ` filter for only this post code
call Sub1: (set filter to “” then turn filter off) `workaround pt1
Me.Filter = “PostCode = Forms!frmmain!txtPCode” ` set filter criteria
call Sub2: (turn filter on) `workaround pt2
End Sub
and this works fine
However, the one that doesn’t work involves more than one criteria
Sub expandPCode_Click() `filter for post code plus or minus 1
(call Sub1)
`set filter criteria
Me.Filter = “PostCode = Forms!frmmain!txtPCode Or PostCode = Left(Forms!frmmain!txtPCode, 2) & Right(Forms!frmmain!txtPCode, 2) + 1 Or PostCode = Left(Forms!frmmain!txtPCode, 2) & Right(Forms!frmmain!txtPCode, 2) – 1”
(call Sub2)
End Sub
This code works fine in 2000 but in 2000 SR-1 the bug crops up again, i.e. it works the first time of asking, but then just returns the same records each time after
I’m at a loss…
In a nutshell, the bug means the filter works correctly the first time it is applied, but after that it always returns the same results. The workaround suggested on the above link involves emptying the filter before applying a new one.
My form gives users the option of filtering the records by 5 criteria, and although the above method does get around the problem for 4 of these, it fails to work on the 5th.
The only difference I can see is that for the 4 that work the criteria is straightforward, e.g. i have a text box that the user enters a post code in called txtPCode
Sub exactPCode_Click() ` filter for only this post code
call Sub1: (set filter to “” then turn filter off) `workaround pt1
Me.Filter = “PostCode = Forms!frmmain!txtPCode” ` set filter criteria
call Sub2: (turn filter on) `workaround pt2
End Sub
and this works fine
However, the one that doesn’t work involves more than one criteria
Sub expandPCode_Click() `filter for post code plus or minus 1
(call Sub1)
`set filter criteria
Me.Filter = “PostCode = Forms!frmmain!txtPCode Or PostCode = Left(Forms!frmmain!txtPCode, 2) & Right(Forms!frmmain!txtPCode, 2) + 1 Or PostCode = Left(Forms!frmmain!txtPCode, 2) & Right(Forms!frmmain!txtPCode, 2) – 1”
(call Sub2)
End Sub
This code works fine in 2000 but in 2000 SR-1 the bug crops up again, i.e. it works the first time of asking, but then just returns the same records each time after
I’m at a loss…