Forum Moderators: open
With that being said, I am having a problem adding an attachment in one of my pages. I am including an elseif statement to meet a certain set of parameters. This will determine what file to attach.
It won't work and, for the life of me, I cannot figure it out.
--------------------------------
With iMsg
Set .Configuration = iConf
.To = "me@me.com"
.From = "you@you.com"
.Subject = "Terms and Conditions for - " &objrs("custName")
.addattachment If (L >= 2002-11-05 AND <= 2004-10-14) AND (O = REPL) THEN
"http://www.accounthotline.com/tc/amtrust/replace.txt"
ElseIf (L >= 2002-11-05 AND <= 2004-10-14) AND (O = SCAR) THEN
"http://www.accounthotline.com/tc/amtrust/repar.txt"
ElseIf (L >= 2002-11-05 AND <= 2004-10-14) AND (O = SHOM) THEN
"http://www.accounthotline.com/tc/amtrust/repar.txt"
ElseIf (L >= 2002-11-05 AND <= 2004-10-14) AND (O = REPL) AND (F = FL) THEN
"http://www.accounthotline.com/tc/amtrust/replaceFL.txt"
ElseIf (L >= 2002-11-05 AND <= 2004-10-14) AND (O = SCAR) AND (F = FL) THEN
"http://www.accounthotline.com/tc/amtrust/repairFL.txt"
ElseIf (L >= 2002-11-05 AND <= 2004-10-14) AND (O = SHOM) AND (F = FL) THEN
"http://www.accounthotline.com/tc/amtrust/repairFL.txt"
ElseIf (L >= 2004-10-15) AND (O = REPL) THEN
"http://www.accounthotline.com/tc/marathon/replace.txt"
ElseIf (L >= 2004-10-15) AND (O = SCAR) THEN
"http://www.accounthotline.com/tc/marathon/repair.txt"
ElseIf (L >= 2004-10-15) AND (O = SHOM) THEN
"http://www.accounthotline.com/tc/marathon/repair.txt"
ElseIf (L >= 2004-10-15) AND (O = REPL) AND (F = FL) THEN
"http://www.accounthotline.com/tc/marathon/replaceFL.txt"
ElseIf (L >= 2004-10-15) AND (O = SCAR) AND (F = FL) THEN
"http://www.accounthotline.com/tc/marathon/repairFL.txt"
ElseIf (L >= 2004-10-15) AND (O = SHOM) AND (F = FL) THEN
"http://www.accounthotline.com/tc/marathon/repairFL.txt"
endif
.htmlBody = " Overstock " & Body
End With
iMsg.Send
response.redirect "done.asp"
-------------------
The regular email function works fine.
.addattachment works fine if I add just one file. The problem I run into is when I try to add this conditional.
Is this even possible?
I appreciate the help.
-Larry
First I tested the data:
--------------------------------
F = rtrim(objrs("state"))
L = rtrim(objrs("dop"))
O = rtrim(objrs("cinhme"))
term1 = "http://www.accounthotline.com/tc/amtrust/replace.txt"
term2 = "http://www.accounthotline.com/tc/amtrust/repair.txt"
term3 = "http://www.accounthotline.com/tc/amtrust/replacefl.txt"
term4 = "http://www.accounthotline.com/tc/marathon/replace.txt"
term5 = "http://www.accounthotline.com/tc/marathon/replaceFL.txt"
term6 = "http://www.accounthotline.com/tc/marathon/repair.txt"
term7 = "http://www.accounthotline.com/tc/marathon/repairFL.txt"
response.write l & "<br>"
response.write f & "<br>"
response.write o & "<br>"
'response.write term1
'response.write term2
If
(L >= "2002-11-05") AND (L <= "2004-10-14") AND (F = "FL") AND (O = "REPL") THEN
response.write term3
ElseIf (L >= "2002-11-05") AND (L <= "2004-10-14") AND (F = "FL") AND (O = "SCAR") THEN
response.write term3
ElseIf (L >= "2002-11-05") AND (L <= "2004-10-14") AND (F = "FL") AND (O = "SHOM") THEN
response.write term3
Elseif (L >= "2002-11-05") AND (L <= "2004-10-14") AND (O = "REPL") THEN
response.write term1
ElseIf (L >= "2002-11-05") AND (L <= "2004-10-14") AND (O = "SHOM") THEN
response.write term2
ElseIf (L >= "2002-11-05") AND (L <= "2004-10-14") AND (F = "FL") AND (O = "REPL") THEN
response.write term3
ElseIf (L >= "2002-11-05") AND (L <= "2004-10-14") AND (F = "FL") AND (O = "SCAR") THEN
response.write term3
ElseIf (L >= "2002-11-05") AND (L <= "2004-10-14") AND (F = "FL") AND (O = "SHOM") THEN
response.write term3
ElseIf (L >= "2004-10-15") AND (F = "FL") AND (O = "REPL") THEN
response.write term5
ElseIf (L >= "2004-10-15") AND (F = "FL") AND (O = "SCAR") THEN
response.write term7
ElseIf (L >= "2004-10-15") AND (F = "FL") AND (O = "SHOM") THEN
response.write term7
ElseIf (L >= "2004-10-15") AND (O = "REPL") THEN
response.write term4
ElseIf (L >= "2004-10-15") AND (O = "SCAR") THEN
response.write term6
ElseIf (L >= "2004-10-15") AND (O = "SHOM") THEN
response.write term6
end if
---------------------------------------------
This works fine. I get all the values I am supposed to be getting. Now I use this code (replacing response.write with .addattachment) in the email page, and I get a page cannot be displayed error.
Code:
------------------------------------------------
Set iMsg = CreateObject("CDO.Message")
Set iConf = CreateObject("CDO.Configuration")
Set Flds = iConf.Fields
With Flds
.Item(cdoSendUsingMethod) = cdoSendUsingPort
.Item(cdoSMTPServer) = "10.0.240.92"
.Update
End With
With iMsg
Set .Configuration = iConf
.To = "me@me.com"
.From = "you@you.com"
.Subject = "Terms and Conditions for - " &objrs("custName")
If
(L >= "2002-11-05") AND (L <= "2004-10-14") AND (F = "FL") AND (O = "REPL") THEN
.addattachment term3
ElseIf (L >= "2002-11-05") AND (L <= "2004-10-14") AND (F = "FL") AND (O = "SCAR") THEN
.addattachment term3
ElseIf (L >= "2002-11-05") AND (L <= "2004-10-14") AND (F = "FL") AND (O = "SHOM") THEN
.addattachment term3
Elseif (L >= "2002-11-05") AND (L <= "2004-10-14") AND (O = "REPL") THEN
.addattachment term1
ElseIf (L >= "2002-11-05") AND (L <= "2004-10-14") AND (O = "SHOM") THEN
.addattachment term2
ElseIf (L >= "2002-11-05") AND (L <= "2004-10-14") AND (F = "FL") AND (O = "REPL") THEN
.addattachment term3
ElseIf (L >= "2002-11-05") AND (L <= "2004-10-14") AND (F = "FL") AND (O = "SCAR") THEN
.addattachment term3
ElseIf (L >= "2002-11-05") AND (L <= "2004-10-14") AND (F = "FL") AND (O = "SHOM") THEN
.addattachment term3
ElseIf (L >= "2004-10-15") AND (F = "FL") AND (O = "REPL") THEN
.addattachment term5
ElseIf (L >= "2004-10-15") AND (F = "FL") AND (O = "SCAR") THEN
.addattachment term7
ElseIf (L >= "2004-10-15") AND (F = "FL") AND (O = "SHOM") THEN
.addattachment term7
ElseIf (L >= "2004-10-15") AND (O = "REPL") THEN
.addattachment term4
ElseIf (L >= "2004-10-15") AND (O = "SCAR") THEN
.addattachment term6
ElseIf (L >= "2004-10-15") AND (O = "SHOM") THEN
.addattachment term6
end if
.htmlBody = " Overstock " & Body
End With
iMsg.Send
response.redirect "done.asp"
_____________________________________
Am I missing something obvious here?
If (L >= "2002-11-05") AND (L <= "2004-10-14") AND (F = "FL") AND (O = "REPL") THEN
strURL = term3
ElseIf (L >= "2002-11-05") AND (L <= "2004-10-14") AND (F = "FL") AND (O = "SCAR") THEN
strURL = term3
ElseIf (L >= "2002-11-05") AND (L <= "2004-10-14") AND (F = "FL") AND (O = "SHOM") THEN
strURL = term3
.............
end if
With iMsg
Set .Configuration = iConf
.To = "me@me.com"
.From = "you@you.com"
.Subject = "Terms and Conditions for - " &objrs("custName")
.addattachment strURL
.htmlBody = " Overstock " & Body
End With
iMsg.Send
response.redirect "done.asp"
Still get a page cannot be displayed.
______________________
C = rtrim(objrs("custName"))
D = rtrim(objrs("addy"))
E = rtrim(objrs("city"))
F = rtrim(objrs("state"))
G = rtrim(objrs("zip"))
H = rtrim(objrs("orderno"))
I = rtrim(objrs("mandes"))
J = rtrim(objrs("prodes"))
K = rtrim(objrs("modNum"))
L = rtrim(objrs("dop"))
M = rtrim(objrs("parexp"))
N = rtrim(objrs("labexp"))
O = rtrim(objrs("cinhme"))
term1 = "http://www.accounthotline.com/tc/amtrust/replace.txt"
term2 = "http://www.accounthotline.com/tc/amtrust/repair.txt"
term3 = "http://www.accounthotline.com/tc/amtrust/replacefl.txt"
term4 = "http://www.accounthotline.com/tc/marathon/replace.txt"
term5 = "http://www.accounthotline.com/tc/marathon/replaceFL.txt"
term6 = "http://www.accounthotline.com/tc/marathon/repair.txt"
term7 = "http://www.accounthotline.com/tc/marathon/repairFL.txt"
dim strURL
if
(L >= "2002-11-05") AND (L <= "2004-10-14") AND (F = "FL") AND (O = "REPL") THEN
strURL = term3
ElseIf (L >= "2002-11-05") AND (L <= "2004-10-14") AND (F = "FL") AND (O = "SCAR") THEN
strURL = term3
ElseIf (L >= "2002-11-05") AND (L <= "2004-10-14") AND (F = "FL") AND (O = "SHOM") THEN
strURL = term3
Elseif (L >= "2002-11-05") AND (L <= "2004-10-14") AND (O = "REPL") THEN
strURL = term1
ElseIf (L >= "2002-11-05") AND (L <= "2004-10-14") AND (O = "SHOM") THEN
strURL = term2
ElseIf (L >= "2002-11-05") AND (L <= "2004-10-14") AND (F = "FL") AND (O = "REPL") THEN
strURL = term3
ElseIf (L >= "2002-11-05") AND (L <= "2004-10-14") AND (F = "FL") AND (O = "SCAR") THEN
strURL = term3
ElseIf (L >= "2002-11-05") AND (L <= "2004-10-14") AND (F = "FL") AND (O = "SHOM") THEN
strURL = term3
ElseIf (L >= "2004-10-15") AND (F = "FL") AND (O = "REPL") THEN
strURL = term5
ElseIf (L >= "2004-10-15") AND (F = "FL") AND (O = "SCAR") THEN
strURL = term7
ElseIf (L >= "2004-10-15") AND (F = "FL") AND (O = "SHOM") THEN
strURL = term7
ElseIf (L >= "2004-10-15") AND (O = "REPL") THEN
strURL = term4
ElseIf (L >= "2004-10-15") AND (O = "SCAR") THEN
strURL = term6
ElseIf (L >= "2004-10-15") AND (O = "SHOM") THEN
strURL = term6
end if
Body = "html body..."
Set iMsg = CreateObject("CDO.Message")
Set iConf = CreateObject("CDO.Configuration")
Set Flds = iConf.Fields
With Flds
.Item(cdoSendUsingMethod) = cdoSendUsingPort
.Item(cdoSMTPServer) = "10.0.240.92"
.Update
End With
With iMsg
Set .Configuration = iConf
.To = "me@me.com"
.From = "you@you.com"
.Subject = "Terms and Conditions for - " &objrs("custName")
.addattachment strURL
.htmlBody = " Overstock " & Body
End With
iMsg.Send
_________________________
I tried this for the hell of it
I replaced the whole if/elseif statement with this:
dim strURL
If
(L= "2005-02-08")
strURL = term3
else
strURL = term4
end if
2005-02-08 is the exact date of the record being called. The page would not display this time either.
This is driving me up the wall.