Peter,
You could try the following:
lnRecNo = RECNO()
SET FILTER TO < whatever >
GO lnRecNo
IF lnRecNo = RECNO()
ELSE
LOCATE
ENDIF
HTH
>The problem is... if the record I want to have "current" IS in the set, I need to GOTO that record. If it is NOT in the set, I need to go to either TOP or the closest record. I can't figure out, other than doing a search through the set, how to get an error flag so I know where to go.
>
>
>
>>>I have an application that displays records in a grid. There are OPTION buttons to limit what records are displayed. I am having a problem "controlling" the current record when using these FILTERS.
>>>
>>>Here is an example.
>>>
>>>
>>>RECNO MARKED
>>>1 N
>>>2 Y
>>>3 N
>>>4 Y
>>>5 Y
>>>6 N
>>>
>>>
>>>In the above table... when my FILTER is set to NONE, all are displayed.
>>>
>>>Assuming my "current" record is 2 and the FILTER is switched to show only MARKED records... then current isn't a problem because it is in the FILTERed records.
>>>
>>>If the "current" record is 3 and the FILTER is switched to show only MARKED records... then current is a problem because that record is NOT displayed.
>>>
>>>I have a METHOD that controls the "highlight" of the current record and this is where the problem is very noticeable. I was storing the current RECNO() and then issuing the FILTER change. Then I was using a GO vStoredRecNo to highlight the "current" record. This worked fine when I was on a displayable record when the filter was changed. The GO appears to operate fine when it is not, but the "current" rec is not there so therefore nothing is highlighted.
>>>
>>>I tried using an EOF() or FOUND() call to see if I could capture this problem to no avail.
>>>
>>>Ideally, if the "current" record is NOT in the displayed filtered set, then I suppose going to TOP would be the course to follow but I don't know how to achieve this short of issuing a series of SEEKS, SKIPS or a LOCATE or somthing similar that will fire an EOF or FOUND().
>>>
>>>Suggestions?
>>
>>Once you've changed your filter, do a GO TOP or just a SKIP to force the filter to "kick in" or any other command that forces the record pointer to move.
Daniel