Hi,<BR><BR>Can someone tell me what&#039s wrong with my code? I&#039m using 2 different sql statements/2 recordsets to provide values for a variable called "strTo".<BR><BR>When I response.write the variable, it contains the proper values, but for some reason the mail object is not being activated. I assume it has something to do with my if statements, but I can&#039t see what the problem is.<BR><BR>Here&#039s the relevant code:<BR><BR>&#060;%<BR>strTo = ""<BR><BR>SQL1 = "Select MsgEmail From tblMessages Where MsgNotify = true and MsgID = " & strMsgID<BR><BR>SQL2 = "Select ReplyEmail From tblReplies Where ReplyNotify = true and MsgID=" & strMsgID<BR><BR>rs1.Open SQL1, oConn<BR><BR>If Not rs1.eof Then<BR>strTo=rs1("MsgEmail")<BR>End If<BR>rs1.close<BR>Set rs1=Nothing<BR><BR>Set rs2=Server.CreateObject("ADODB.Recordset")<BR>rs2. Open SQL2, oConn<BR><BR>If strTo &#060;&#062; "" Then<BR>Do While Not rs2.eof<BR>strTo = strTo & ", " & rs2("ReplyEmail")<BR>rs2.MoveNext<BR>Loop<BR>Else< BR>If not rs2.eof Then<BR>strTo = rs2("ReplyEmail")<BR>rs2.MoveNext<BR>Do While Not rs2.eof<BR>strTo = strTo & ", " & rs2("ReplyEmail")<BR>rs2.MoveNext<BR>Loop<BR>End If<BR><BR>Set myCDONTSMail = Server.CreateObject("CDONTS.NewMail")<BR>myCDONTSM ail.Send strFrom,strTo,strSubject,strBody<BR>Set myCDONTSMail = Nothing<BR><BR>End If<BR><BR>rs2.Close<BR>Set rs2=Nothing<BR><BR>Response.Write strTo<BR>%&#062;<BR><BR>What I&#039m doing is checking the first table for an email address (there can only be one in the first table). If it has one it assigns it to strTo. Then it opens the 2nd recordset and if strTo is empty (nothing in the first table) it assigns the first address to strTo, otherwise it adds it to the existing value, then loops through the rest and adds any more that might exist in the 2nd table.<BR><BR>It&#039s possible that there will be no values in "strTo". I only want to activate the mail object if strTo contains at least one address.<BR><BR>Thanks for any suggestions and if anyone knows of a simpler way to do what I&#039m trying to do, I&#039d love to hear it!<BR><BR>ginger