Help on sendObject Error

mapat

Registered User.
Local time
Yesterday, 21:52
Joined
Feb 2, 2007
Messages
176
Hello everyone,

The DoCmd.SendObject command was working fine. Now it is giving me
a run-time error '2501' saying "The SendObject action was canceled"
Would anyone know why this is happening??
Thanks

PS:I looked up for this error number but it doesn't say anything related to the SendObject method
 
the email opens up and is correct but when I close the email is when it gives me that error
This is the code:

str_Recipient = DLookup("[Contacts]!", "[Contacts]", "[Contacts]![CID]=[Forms]!
[QUOTES_CONTROL]![CID]")
str_Subject = "Quote Reminder To " & [Forms]![QUOTES_CONTROL]![Co]
str_Body = "This is working"
DoCmd.SendObject acSendNoObject, , , str_Recipient, , , str_Subject, str_Body, -1
 
2501 is generated when you cancel something. So, when you close the email it is cancelling the send. You can use an error handler to ignore that error when it occurs. Put it in the code that runs the send object code.
 
I put 'On Error Resume Next' and now it works perfect

Thanks everyone so much
 
I put 'On Error Resume Next' and now it works perfect

Thanks everyone so much

You still might want to test for the 2501 error and display a message if it ISN'T a 2501 because by putting On Error Resume Next, if any other errors occur, you won't know about them.
 

Users who are viewing this thread

Back
Top Bottom