I
Ivan Grozney
I am trapping the 2501 Error after someone closes an email without sending
it. So in the ErrorRoutine, I am asking them to send it. If they click
okay, then it runs SendObject again. However if they close it without
sending it again, the END/DEBUG dialog box with RUNTIME ERROR 2501 shows up
again.
I have tried ERR.CLEAR but it doesn't help.
Below is part of my code. Anyone have any ideas?
************** Code Snippet Start ***************************
SendIt:
DoCmd.SendObject acSendNoObject, strBody, acFormatTXT, _
sAddress, , , "New Stuff", strBody, True
RoutineExit:
GoTo AddAgain:
ErrorRoutine:
If Err.Number = 2501 Then
Msg = "Yada Yada 1 " & vbCrLf & _
"Yada Yada 2" & vbCrLf & vbcrlf & _
"Yada Yada 3"
Style = vbYesNo + vbDefaultButton1
Title = "Please Send"
Response = MsgBox(Msg, Style, Title)
If Response = vbNo Then
GoTo AddAgain:
Else
GoTo SendIt:
End If
Else
MsgBox "Error number: " & Err.Number & vbCrLf & vbCrLf & _
Err.Description, vbCritical, "Error"
End If
Resume RoutineExit
....
************** Code Snippet End *******************************
TIA
Vanya
it. So in the ErrorRoutine, I am asking them to send it. If they click
okay, then it runs SendObject again. However if they close it without
sending it again, the END/DEBUG dialog box with RUNTIME ERROR 2501 shows up
again.
I have tried ERR.CLEAR but it doesn't help.
Below is part of my code. Anyone have any ideas?
************** Code Snippet Start ***************************
SendIt:
DoCmd.SendObject acSendNoObject, strBody, acFormatTXT, _
sAddress, , , "New Stuff", strBody, True
RoutineExit:
GoTo AddAgain:
ErrorRoutine:
If Err.Number = 2501 Then
Msg = "Yada Yada 1 " & vbCrLf & _
"Yada Yada 2" & vbCrLf & vbcrlf & _
"Yada Yada 3"
Style = vbYesNo + vbDefaultButton1
Title = "Please Send"
Response = MsgBox(Msg, Style, Title)
If Response = vbNo Then
GoTo AddAgain:
Else
GoTo SendIt:
End If
Else
MsgBox "Error number: " & Err.Number & vbCrLf & vbCrLf & _
Err.Description, vbCritical, "Error"
End If
Resume RoutineExit
....
************** Code Snippet End *******************************
TIA
Vanya