Forum Moderators: open
if cstr(formatdatetime(Master("RecordEndDate"),2)) > cstr(formatdatetime(dateadd("yyyy",+(years - 1),formatdatetime("6/30/1998",2)),2)) and cstr(formatdatetime(Master("RecordEndDate"),2)) < cstr(formatdatetime(dateadd("yyyy",+(years + 1),formatdatetime("6/30/1998",2)),2)) then
I have tried all kinds of formatting statements but so far it doesn't show any of my records as being within the date range. (most dates are 5/5/2008). Years is a counter I'm running through that goes 10 years.
Any suggestions or hints would be very appriciated,
Casey
if (DateValue(Master("RecordEndDate")) > DateValue(dateadd("yyyy",+(years - 1),"6/30/1998"))) and (DateValue(Master("RecordEndDate")) < DateValue(dateadd("yyyy",+(years + 1),"6/30/1998"))) then
You need to compare dates, not strings. You can't use operators on string values. I did this quickly, so make sure I didn't delete a parens that was needed.