Hi,
i am emailing a report, if the report records are null, then the email send must be canceled
maybe with a comment that there is no records to be mailed
at this point in time if there is no record, the message i receive is the sendobject action was canceled then a end and debug screen
Below is my code, what should I do to change the pop us screen to indicate no records
you help would me appreciated
i am emailing a report, if the report records are null, then the email send must be canceled
maybe with a comment that there is no records to be mailed
at this point in time if there is no record, the message i receive is the sendobject action was canceled then a end and debug screen
Below is my code, what should I do to change the pop us screen to indicate no records
you help would me appreciated
Private Sub Command0_Click()
Dim rs As Recordset
Dim vRecipientList As String
Dim vMsg As String
Dim vSubject As String
Set rs = CurrentDb.OpenRecordset("SELECT * FROM TechSupportEmail ")
If rs.RecordCount > 0 Then
rs.MoveFirst
Do
If Not IsNull(rs!email) Then
vRecipientList = vRecipientList & rs!email & ";"
rs.MoveNext
Else
rs.MoveNext
End If
Loop Until rs.EOF
vMsg = "Please find attached new document loaded"
vSubject = "New Document Loaded"
DoCmd.SendObject acSendReport, "Email SB Notification - From TechPubs to Tech Support", acFormatPDF, vRecipientList, , , vSubject, vMsg, False
MsgBox ("Report successfully eMailed!")
Else
MsgBox "No contacts."
End If
DoCmd.RunMacro "Save Dual Inspection"
End Sub