stevemarsh99
Technical User
Hey guys and girls,
i have a page that runs an IF statement to send an email. great, but now I want the if statment to run IF todays MINUS 2 DAYS is equal to a date in a database?
i have it working with if todays date ADDED ONE DAY (tomorrow basically) is equal to my db date, but if i go back in time it runs the statment even if the date is tomorrow!
here is my code:
<%
strToday = dateadd("d", date(), 1)
strClose = dateadd("d", date(), -2)
strMyDate = (rs_ealert.Fields.Item("MAGDATE").Value)
%>________________________
____________________________
<%
if strClose = strMyDate then
%>
<%
FormFields = "to~body~subject"
Set objCDO = Server.CreateObject("CDONTS.NewMail")
objCDO.From = "dfs@sdf.com"
objCDO.To = (rs_ealert.Fields.Item("MAGDATE_CONTACT").Value)
objCDO.Cc = ""
objCDO.Bcc = ""
objCDO.Subject = "blah"
BodyString = "text goes here"
objCDO.Body = BodyString
objCDO.BodyFormat = 0
objCDO.MailFormat = 0
objCDO.Send
Set objCDO = Nothing %>
<% else %>
<% Response.Write("") %>
<% end if %>
i have a page that runs an IF statement to send an email. great, but now I want the if statment to run IF todays MINUS 2 DAYS is equal to a date in a database?
i have it working with if todays date ADDED ONE DAY (tomorrow basically) is equal to my db date, but if i go back in time it runs the statment even if the date is tomorrow!
here is my code:
<%
strToday = dateadd("d", date(), 1)
strClose = dateadd("d", date(), -2)
strMyDate = (rs_ealert.Fields.Item("MAGDATE").Value)
%>________________________
____________________________
<%
if strClose = strMyDate then
%>
<%
FormFields = "to~body~subject"
Set objCDO = Server.CreateObject("CDONTS.NewMail")
objCDO.From = "dfs@sdf.com"
objCDO.To = (rs_ealert.Fields.Item("MAGDATE_CONTACT").Value)
objCDO.Cc = ""
objCDO.Bcc = ""
objCDO.Subject = "blah"
BodyString = "text goes here"
objCDO.Body = BodyString
objCDO.BodyFormat = 0
objCDO.MailFormat = 0
objCDO.Send
Set objCDO = Nothing %>
<% else %>
<% Response.Write("") %>
<% end if %>