><Code> >lnYear = 1997 >SELECT MyTable >SET ORDER TO myDate >SET NEAR ON >SEEK( DATE(lnYear + 1, 1, 1)) >IF YEAR( myDate) > lnYear AND NOT BOF() >skip -1 >ENDIF ></Code> >>
Use in Select('MyCursor') create cursor MyCursor (MyDate D) For iYear = 1990 to 2100 For iMonth = 1 to 10 Insert into Mycursor Values(ctod(Alltrim(Str(iMonth)) + '/01/' + Alltrim(str(iYear)))) Next Next Index on YEAR(myDate) tag yDat Set order to tag yDat descending =Seek('2001') Set order to Tag yDat Ascending *!* We are now on the last record for 2001HTH