I have the following code:
Do While Not rs.EOF
If Not IsNull(rs!EMail) Then
str = rs!EMail
DoCmd.SetWarnings False
DoCmd.SendObject acSendReport, rptstr, acFormatSNP, str, , , rsn!SbjLine
rs.Edit
rs!RptMlDt = Date
rs.Update
SkipEMail:
End If
rs.MoveNext
Loop...
Form_Open_Errors:
If Err.Number = 2501 Then
DoCmd.SetWarnings True
GoTo SkipEMail
Else
...
End if
On the first record through, if the e-mail is canceled, it works fine. However, on the next record, I get a message box that says:
Run Time Error '2501':
The SendObject Action was canceled.
I got this on the first run through before I added the SetWarning lines, after which the first e-mail cancelation behaved properly. I tried commenting out the SetWarnings True line, but that didn't stop the error message on the second e-mail.
What's wrong?
Do While Not rs.EOF
If Not IsNull(rs!EMail) Then
str = rs!EMail
DoCmd.SetWarnings False
DoCmd.SendObject acSendReport, rptstr, acFormatSNP, str, , , rsn!SbjLine
rs.Edit
rs!RptMlDt = Date
rs.Update
SkipEMail:
End If
rs.MoveNext
Loop...
Form_Open_Errors:
If Err.Number = 2501 Then
DoCmd.SetWarnings True
GoTo SkipEMail
Else
...
End if
On the first record through, if the e-mail is canceled, it works fine. However, on the next record, I get a message box that says:
Run Time Error '2501':
The SendObject Action was canceled.
I got this on the first run through before I added the SetWarning lines, after which the first e-mail cancelation behaved properly. I tried commenting out the SetWarnings True line, but that didn't stop the error message on the second e-mail.
What's wrong?