ltNow = DATETIME() lnYr = YEAR(m.ltNow) lnMo = MONTH(m.ltNow) lnDy = DAY(m.ltNow) lnDiff = 60 && Adjust to whatever you need SELECT att_pk; FROM AutoTask; WHERE (m.ltNow-DATETIME(m.lnYr,m.lnMo,m.lnDy,att_hour,att_min))<=m.lnDiff; INTO CURSOR crsrAutoTasks(the above code will need a few tweaks to work correctly for cases where the hour and date are close to the end of the day)