Forums

This topic is locked

Conditional CDONTS..Need variable syntax help

Posted 25 Feb 2002 17:35:22
1
has voted
25 Feb 2002 17:35:22 Arash Attarzadeh posted:
I've gotten CDONTS to work when I submit a page. However I have a drop down field called Status. I only want to send an email when the status field is set to Closed and the record is updated. The problem I'm having is with the syntax of the variable. Below is a copy of the working and not working code...

<b>WORKING</b>

If (cStr(Request("Submit") &lt;&gt; "" Then
dim mymail
set mymail = server.CreateObject("cdonts.newmail"
mymail.from = " "
mymail.to = " "
mymail.Subject = "Testing CDNOTS"
mymail.body = "THIS IS THE BODY"
mymail.send
set mymail = nothing
End If


<b>NOT WORKING</b>

If (cStr(Request("Submit") <i>And tcg_tbl.Fields.Item("Status".Value = "Closed"</i> &lt;&gt; "" Then
dim mymail
set mymail = server.CreateObject("cdonts.newmail"
mymail.from = " "
mymail.to = " "
mymail.Subject = "Testing CDNOTS"
mymail.body = "THIS IS THE BODY"
mymail.send
set mymail = nothing
End If


The section that isn't working is in italics. I've tried the following as well to no avail...

(CStr(statuslist.Fields.Item("Status".Value)
(statuslist.Fields.Item("Status".Value)
"&lt;%=(tcg_tbl.Fields.Item("Status".Value)%&gt;"
form1.status.value


If anyone can help me nail down the sytax, I would be greatfull.

Thanks in advance!
Maz

Replies

Replied 25 Feb 2002 21:50:35
25 Feb 2002 21:50:35 Eric Boyer replied:
maybe something like this?
If cStr(Request("Submit")&lt;&gt; "" And tcg_tbl.Fields.Item("Status".Value = "Closed" Then

Replied 26 Feb 2002 11:38:57
26 Feb 2002 11:38:57 Viktor Farcic replied:
I be sure to place this code below code for creating recordset.

Viktor Farcic

TalkZone Manager
Replied 22 Apr 2002 21:28:00
22 Apr 2002 21:28:00 Chris Nagano replied:
I have a similar question, only I'd like to populate my message body with field values on the condition that they are not null...

Can I use an if/then within a variable ("mailBody" to return if not null? Any tips on how this should be structured?

danke~

nagano

<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
maybe something like this?
If cStr(Request("Submit")&lt;&gt; "" And tcg_tbl.Fields.Item("Status".Value = "Closed" Then


<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote><font face='Verdana'></font id='Verdana'>

Reply to this topic