SendObject

batman26

Registered User.
Local time
Today, 01:08
Joined
Jul 13, 2003
Messages
22
Using the DoCmd.SendObject method to open an e-mail in the Before Update event, how do I handle the canceling of sending the e-mail and still have the update event fire?:confused:
 
Can you be a little more specific? Posting the code involved could be useful.

Thanks
 
You could give something like this a try:

Code:
Private Sub SomeControl(Cancel As Integer)
    If bla bla bla Then
        Cancel = True
        Call SomeControl_AfterUpdate
    End If
End Sub
 
Here is the code...what I'm not sure how to do is respond to canceling the e-mail. The system has its own error message but I would like to replace it and cancel the update event (Cancel = -1).

Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim strCIFRef As String
Dim strCBRef As String
Dim strCIFNBR As String
Dim dtCB As Date

If Me.Dirty Then
If IsNull(Forms!frmCMPGN_BRF.txtAcctPlnr) Then _
Forms!frmCMPGN_BRF.txtAcctPlnr = CurrentUser()
strCIFRef = Forms!frmCMPGN_BRF.txtRqstr
strCBRef = Forms!frmCMPGN_BRF.txtAcctPlnr
strCIFNBR = Forms!frmCMPGN_BRF.txtJobNBR
dtCB = Forms!frmCMPGN_BRF.txtDate

DoCmd.SendObject , , , strCIFRef, , , "The Budget Segment _
of C.I.F. Number '" & strCIFNBR & "' has been Changed",_
"The Budget Segment of C.I.F. Number '" & strCIFNBR & "' _
has been Changed by " & strCBRef & " on " & dtCB & _
": Please Review the Changes.", True
End If

End Sub
 
The message you are referring to is the "SendObject was cancelled, blah, blah"? This is treated as an error.

If you have standard error trapping, it will look something like this

On Error GoTo Err_ Form_BeforeUpdate


Your code continues
-
-
-

Err_ Form_BeforeUpdate:

MsgBox Err. Description
Resume Exit_Form_BeforeUpdate

You can replace the standard Err.Description with a custom message box and any desired code, including the Cancel argument.
 
send object

Thank you oh Ancient One. I might have caught this if i had put in error handling, but I'm just developing this and I tend to go back through the code and put in the error handling...maybe I should rethink my methodology. Thanks again.
 

Users who are viewing this thread

Back
Top Bottom