Emailing from Access to Outlook Error

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a field for entering addresses in my database and I would like for a
user to click on the e-mail address in the field and it opens Outlook. I
used the following code for the OnClick Event Procedure:

DoCmd.SendObject acSendNoObject, , , [E-MAIL]

When I click on the e-mail address on my form, it will open Outlook but when
I try to close the message I get a "Run-time error '2501': The SendObject
action was canceled" and Microsoft Visual Basic opens for me to debug the
code. How can correct this?

TB
 
You need to add in some error handleing code. Somthing like:

On Error Goto Err_NameOfYourButton_Click

DoCmd.SendObject acSendNoObject, , , [E-MAIL]

Exit_NameOfYourButton_Click:
Exit Sub

Err_NameOfYourButton_Click:


End Sub

Leaving Err_Nameof yourbutton with nothing in it will stop the error message
occuring. For some reason setwarnings off does not work in this case.

HTH

Rico
 
It works. THANK YOU!!!!!

rico said:
You need to add in some error handleing code. Somthing like:

On Error Goto Err_NameOfYourButton_Click

DoCmd.SendObject acSendNoObject, , , [E-MAIL]

Exit_NameOfYourButton_Click:
Exit Sub

Err_NameOfYourButton_Click:


End Sub

Leaving Err_Nameof yourbutton with nothing in it will stop the error message
occuring. For some reason setwarnings off does not work in this case.

HTH

Rico


TB said:
I have a field for entering addresses in my database and I would like for a
user to click on the e-mail address in the field and it opens Outlook. I
used the following code for the OnClick Event Procedure:

DoCmd.SendObject acSendNoObject, , , [E-MAIL]

When I click on the e-mail address on my form, it will open Outlook but when
I try to close the message I get a "Run-time error '2501': The SendObject
action was canceled" and Microsoft Visual Basic opens for me to debug the
code. How can correct this?

TB
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top