Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date command

Status
Not open for further replies.

stevemarsh99

Technical User
Aug 10, 2005
88
GB
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 %>
 
great...this works too...

<% IF Datediff("d",(rs_ealert.Fields.Item("MAGDATE").Value),Date())>=2 then %>

damber, thanks for correcting...i am currently working more on the sql server, so tuned to it right now...i guess you know what i am talking abt...

Sheco, those are lot of variables ;)...just kidding

-DNG
 
[tt]
BodyString = "Frankenfurter: " & Frankenfurter & vbCrLf _
& "Rocky: " & Rocky & vbCrLf _
& "(Frankenfurter >= Rocky): " & cStr(Frankenfurter >= Rocky)
[/tt]
 
I think Sheco's been drinking again... [2thumbsup]

A smile is worth a thousand kind words. So smile, it's easy! :)
 
I started with the RHPS character names after the 2nd TimeWarp reference.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top