Recordset and Null Fields

Novice1

Registered User.
Local time
Today, 08:05
Joined
Mar 9, 2004
Messages
385
I'm trying to build a list of e-mail addresses; however some of the fields are blank. If all the fields are filled in, no problem; however, if one of the fields is blank the process stops. I'm using the following code to cycle thru the records without success.


If rs.RecordCount > 0 Then
rs.MoveFirst

Do

If Not IsNull(rs!CCF_EMail) Then
vRecipientList = vRecipientList & rs!CCF_EMail & ";"
End If

If Not IsNull(rs!CC_Email) Then
vRecipientList2 = vRecipientList2 & rs!CC_Email & ";"
End If


If Not IsNull(rs!Chief_Email) Then
vRecipientList3 = vRecipientList3 & rs!Chief_Email & ";"
End If

rs.MoveNext

Loop Until rs.EOF


DoCmd.SendObject acSendReport, "rptNotification", acFormatPDF, vRecipientList2, vRecipientList3, , "PCS Orders Cannot be Published " & vbCr & vbCr & _
"Pending", "Sir/Ma'am," & vbCr & vbCr & "BLUF: Members from your unit, on the attached listing, blah blah", True

Else
 
This too doesn't work unless the fields have data.


If rs.RecordCount > 0 Then
rs.MoveFirst
Do
If Not IsNull(rs!CCF_EMail) Then
vRecipientList = vRecipientList & rs!CCF_EMail & ";"
vRecipientList2 = vRecipientList2 & rs!CC_Email & ";"
rs.MoveNext
Else
rs.MoveNext
End If


Loop Until rs.EOF
 

Users who are viewing this thread

Back
Top Bottom