Code:
Do While DR.Read()
If Not DR.Item("Date Due") Is DBNull.Value Then
If DR.Item("Date Due") < ThisMoment Then
If Not DR.Item("org_account_mgr") Is DBNull.Value Then
If Not DR.Item("org_account_mgr") = "RESELLER" Then
If Not DR.Item("org_account_mgr") = "none" Then
TextBox1.Text &= vbCrLf & DR.Item("SupportKey") & "," & DR.Item("Date Due") & "," & DR.Item("ShortDesc") & ",OVERDUE," & DR.Item("org_account_mgr") & " - " & txttime.Text
msgbody &= "Support Key: <A HREF='http://kermit/support/default.asp?LogNumber=" & DR.Item("SupportKey") & "'>" & DR.Item("SupportKey") & "</A>, Due on Date: " & DR.Item("Date Due") & "<BR>For Company: " & DR.Item("org_name") & ", With Description: " & DR.Item("ShortDesc") & "<BR><BR>"
mailsender(DR.Item("org_account_mgr") & "@twang.net", "Support Key: <A HREF='http://kermit/support/default.asp?LogNumber=" & DR.Item("SupportKey") & "'>" & DR.Item("SupportKey") & "</A>, Due on Date: " & DR.Item("Date Due") & "<BR>For Company: " & DR.Item("org_name") & ", With Description: " & DR.Item("ShortDesc") & "<BR><BR>", "Support has an overdue item for one of your customers")
Else
TextBox1.Text &= vbCrLf & DR.Item("SupportKey") & "," & DR.Item("Date Due") & "," & DR.Item("ShortDesc") & ",OVERDUE" & " - " & txttime.Text
msgbody &= "Support Key: <A HREF='http://kermit/support/default.asp?LogNumber=" & DR.Item("SupportKey") & "'>" & DR.Item("SupportKey") & "</A>, Due on Date: " & DR.Item("Date Due") & "<BR>For Company: " & DR.Item("org_name") & ", With Description: " & DR.Item("ShortDesc") & "<BR><BR>"
End If
End If
End If
Else
TextBox1.Text &= vbCrLf & DR.Item("SupportKey") & "," & DR.Item("Date Due") & "," & DR.Item("ShortDesc") & " - " & txttime.Text
End If
End If
Loop
This is causing me grief, what I essentially want it to do is if that account manager is not blank, or "RESELLER" or "none" then don't send an e-mail using the sub mailsend, but always but an audit in the textbox1.text.
At present it seems to miss off records, etc. Is there a better way to do this, i.e. one that works?