p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

access thread: SendObject Error


Message #1 by "George Oro" <george@c...> on Mon, 10 Jun 2002 13:48:02 +0400
Hi Guys,

In my Client Data Entry Form I put an Envelop Icon (image) next to the email address. Then on click of that Envelop I assign this
code:

-------------------------------
Private Sub cmdEmail_Click()
On Error GoTo Err_cmdEmail_Click

	dim strEmail as String
	strEmail = me.c20EmailAddress

	DoCmd.SendObject , , , strEmail, , , , , True

Exit_cmdEmail_Click:
    Exit Sub

Err_cmdEmail_Click:
    MsgBox Err.Description
    Resume Exit_cmdEmail_Click

End Sub
----------------------------

If I will complete the email and send it, it is fine, but if I will cancel by clicking the close(X) button then I will get this
error message:


The Send Object was canceled.

You used a method of DoCmd Object to carry out an action in Visual Basic, but then clicked Cancel in a dialog box.
For Example, you used the Close method to close a changed form, the clicked cancel in the dialog box that ask if you want to save
the changes you made to the form.

Then my db will hang, I press Ctl+Ald+Del to exit, then another message will pop-up.

If you're running a Visual Basic Module that is using OLE or DDE, you may need to interrupt the module.

One thing I noticed is , if I will open my form on the Database Window and do the above... "No error." But if I will start from my
start up Form then Display Database Window = False..."Error Again!".

Guys, any idea? PLEASE HELP...


TIA
George :(

Message #2 by "Amy Wyatt" <amyw@c...> on Mon, 10 Jun 2002 16:59:44
In order to bypass this error you are going to need to trap it and then 
ignore it or skip to the next step. I believe the error number is 2501 so 
if you do this in your error trap you should be abel to click the cancel 
without displaying the error and interrupting the code whichi is probably 
why the machine is locking up.


Exit_cmdEmail_Click:
    Exit Sub

Err_cmdEmail_Click:
    
    If Err.Number = 2501 then
        Resume Next (or Resume Exit_cmdEmail_Click)
    Else
        MsgBox Err.Description
        Resume Exit_cmdEmail_Click
    End IF

Hope this helps,

Amy

> Hi Guys,

In my Client Data Entry Form I put an Envelop Icon (image) next to the 
email address. Then on click of that Envelop I assign this
code:

-------------------------------
Private Sub cmdEmail_Click()
On Error GoTo Err_cmdEmail_Click

	dim strEmail as String
	strEmail = me.c20EmailAddress

	DoCmd.SendObject , , , strEmail, , , , , True

Exit_cmdEmail_Click:
    Exit Sub

Err_cmdEmail_Click:
    MsgBox Err.Description
    Resume Exit_cmdEmail_Click

End Sub
----------------------------

If I will complete the email and send it, it is fine, but if I will cancel 
by clicking the close(X) button then I will get this
error message:


The Send Object was canceled.

You used a method of DoCmd Object to carry out an action in Visual Basic, 
but then clicked Cancel in a dialog box.
For Example, you used the Close method to close a changed form, the 
clicked cancel in the dialog box that ask if you want to save
the changes you made to the form.

Then my db will hang, I press Ctl+Ald+Del to exit, then another message 
will pop-up.

If you're running a Visual Basic Module that is using OLE or DDE, you may 
need to interrupt the module.

One thing I noticed is , if I will open my form on the Database Window and 
do the above... "No error." But if I will start from my
start up Form then Display Database Window = False..."Error Again!".

Guys, any idea? PLEASE HELP...


TIA
George :(


  Return to Index