Hey there folks--
I'm trying to build a query during runtime to populate a grid based on a date range. One of the fields in the grid is a DateTime and the date range text box values init to "=date()", so they return date values.
I'm wondering if there's a more efficient way to do date comparisons than this:
This works, but I'm wondering if there's an easier way to get a date value into the SQL string for a date-to-date comparison.
Thanks
-- michael~
PS.- Anyone know when the search function is gonna be working again?![[sadeyes] [sadeyes] [sadeyes]](/data/assets/smilies/sadeyes.gif)
I'm trying to build a query during runtime to populate a grid based on a date range. One of the fields in the grid is a DateTime and the date range text box values init to "=date()", so they return date values.
I'm wondering if there's a more efficient way to do date comparisons than this:
Code:
ldstdate = thisform.txtstdate.value
ldenddate = thisform.txtenddate.value
lcsqlst = "SELECT * FROM audit WHERE (ddate >= {^" +;
ALLTRIM(STR(YEAR(ldstdate))) + "/" + ;
ALLTRIM(STR(MONTH(ldstdate))) + "/" + ;
ALLTRIM(STR(DAY(ldstdate))) + ;
"} AND ddate <= {^" + ;
ALLTRIM(STR(YEAR(ldenddate))) + "/" + ;
ALLTRIM(STR(MONTH(ldenddate))) + "/" + ;
ALLTRIM(STR(DAY(ldenddate))) + ;
"} ORDER BY ddate DESC INTO CURSOR curgrdaudit"
This works, but I'm wondering if there's an easier way to get a date value into the SQL string for a date-to-date comparison.
Thanks
-- michael~
PS.- Anyone know when the search function is gonna be working again?
![[sadeyes] [sadeyes] [sadeyes]](/data/assets/smilies/sadeyes.gif)