>sdate={^2003/08/01} >edate={^2003/08/31} >use dtr >set filter to between(swipedate,sdate,edate) >locate >>
#DEFINE hdStartDate {^2003/08/01} #DEFINE hdEndDate {^2003/08/31} CLOSE DATABASES ALL CREATE CURSOR BetweenTest ; (dDate D) LOCAL ; ldDate, ; lnIx, ; lnFilteredRecordCount ldDate = hdStartDate DO WHILE ldDate <= hdEndDate INSERT INTO BetweenTest ; (dDate) ; VALUES ; (ldDate) ldDate = ldDate + 1 ENDDO SELECT BetweenTest SET FILTER TO BETWEEN(dDate, hdStartDate, hdEndDate) LOCATE ?BetweenTest.dDate && Finds first record 2003.08.01 COUNT ALL TO lnFilteredRecordCount ?lnFilteredRecordCount && Returns expected value, 31Is the code you show your actual code? Is it possible the variables sdate and edate are going out of scope? Are you certain your date values are actually between your start and end dates - maybe the date format is different from what you expect?