I'm trying to find out why the below doesn't work. What I'm trying to do is if the TnCReviewDate is greater than a year in the past, then output a messagebox. I tried to use the DateDiff function to facilitate this, but it's not working. D2 is the current date and d1 is supposed to be one year in the past, and diff is the comparison between the two which should be a year. If the TnCReviewDate is newer than a year, nothing should happen. What am I doing wrong?
dim d1, d2, diff
d1 = DateAdd("y",-1,d2)
d2 = now()
diff = DateDiff("y", d1, d2)
if SystemVariables.CodeObject.Company = "T" then
if AdditonalFields.CodeObject.TnCReviewDate > diff and (AdditonalFields.CodeObject.KeyAccount = "Y") then
msgbox "Please review T & C for this customer!"
else
' do nothing
end if
end if