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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

looping thru a recorset and CDONTS mail

Status
Not open for further replies.

geerae

Programmer
Aug 5, 2001
17
US
I'm generating an automatic email usint CDONTS and I'm having trouble.
The email has an html header that works wonderfully. My problem is the body, I can't seem to figure out the syntax.
The body is this set of looped records.


Do Until TestResult.EOF
No = TestResult("QuestionNo")
Procedure = TestResult("Procedure")
PF = TestResult("PassFail")
tcomment = TestResult("Comments")%>
body = <tr><td>No & Procedure & PF & tcomment</td></tr>
TestResult.MoveNext
Loop


mail.body = header & body

This is giving me the last record only of the recordset.
 
Fist I assume that the %> in the middle of the code is a mistake.

modify the code as follows

Do Until TestResult.EOF
No = TestResult(&quot;QuestionNo&quot;)
Procedure = TestResult(&quot;Procedure&quot;)
PF = TestResult(&quot;PassFail&quot;)
tcomment = TestResult(&quot;Comments&quot;)
body =body & &quot;<tr><td>&quot; & No & Procedure & PF & tcomment & &quot;</td></tr>&quot; & vbcrlf
TestResult.MoveNext
Loop


mail.body = header & body

Also you may want to provide additional columns between your variables as follows

body =body & &quot;<tr><td>&quot; & No & &quot;</TD><TD>&quot; & Procedure & &quot;</TD><TD>&quot; & PF & &quot;</TD><TD>&quot; & tcomment & &quot;</td></tr>&quot; & vbcrlf
 
duh.. That did the trick.

I actually have columns dividing the records, I just didn't want to have my post polluted with code.

Thank you...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top