Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / September 2006

Tip: Looking for answers? Try searching our database.

stop code sending cancelled email

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
judith - 06 Feb 2006 09:00 GMT
I am sending an email from the statement
DoCmd.SendObject acSendNoObject, "", acFormatTXT, strTo, , , strSubject,
strBody & strTemplate
This is great as it opens up the email for editing. But if i click the x
(close button) on the email with the intention of sending it to the drafts
folder before sending, it gives an error "The send action was cancelled" and
if i just end it goes to the outbox anyway. Is there any way i can stop the
email sending if i change my mind at the last minute

Thanks
Allen Browne - 06 Feb 2006 09:18 GMT
Add error-handling to the procedure that contains this line, and trap error
2501.

Example:

Private Sub Command5_Click()
On Error GoTo Err_Handler

   DoCmd.SendObject ...

Exit_Handler:
   Exit Sub

Err_Handler:
   If Err.Number <> 2501 Then
       MsgBox "Error " & Err.Number & ":" & Err.Description
   End If
   Resume Exit_Handler
End Sub

Signature

Allen Browne - Microsoft MVP.  Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

>I am sending an email from the statement
> DoCmd.SendObject acSendNoObject, "", acFormatTXT, strTo, , , strSubject,
[quoted text clipped - 8 lines]
>
> Thanks
judith - 06 Feb 2006 10:09 GMT
Oops, sorry thought the error handling was working but it seems not. It looks
as though as soon as it goes to the satement

DoCmd.SendObject acSendNoObject, "", acFormatTXT, strTo, , , strSubject,
strBody & strTemplate

it locks itself. I cant navigate away from the email window and it also
seems at that point to have put the email in the outbox.
I am using a procedure from
'A procedure to send report in a body of mail message
'Alex Dybenko, http://Alex.Dybenko.com
as i need to convert the access report to email body text but cant see that
that is having any effect.

Any suggestions please

Thanks

> Add error-handling to the procedure that contains this line, and trap error
> 2501.
[quoted text clipped - 28 lines]
> >
> > Thanks
Alex Dybenko - 06 Feb 2006 11:20 GMT
Hi,
will it work, if you click on send button, instead of x button on email
message?

Signature

Alex Dybenko (MVP)
http://alexdyb.blogspot.com
http://www.PointLtd.com

> Oops, sorry thought the error handling was working but it seems not. It
> looks
[quoted text clipped - 53 lines]
>> >
>> > Thanks
judith - 06 Feb 2006 11:29 GMT
yes the send button works fine. in fact i think it does an immediate send
rather than wait for the schedule but it certainly goes. I am puzzled as to
why the x button does not just put it into drafts

> Hi,
> will it work, if you click on send button, instead of x button on email
[quoted text clipped - 57 lines]
> >> >
> >> > Thanks
Allen Browne - 06 Feb 2006 12:42 GMT
From Access' point of view, SendObject either succeeds (the email goes) or
fails (it did not go.)

If you want to save if for later, try hitting the Save button in your email
program. This should save it somewhere (inbox or drafts or something.) Then
close the email without sending (your X button.) The cancel triggers error
2501 in Access, which you can trap and ignore. But if you saved it before
cancelling, it should still be available in your email software later.

Signature

Allen Browne - Microsoft MVP.  Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

> yes the send button works fine. in fact i think it does an immediate send
> rather than wait for the schedule but it certainly goes. I am puzzled as
[quoted text clipped - 63 lines]
>> >> > the
>> >> > email sending if i change my mind at the last minute
judith - 06 Feb 2006 13:09 GMT
thanks for your help. as you say it either goes or doesnt. i tried the save
but still have to click x to exit as the screen seems to be locked and at
that stage it goes! Will just have to impress on my users that send means
send. Is there a reason why it locks the message screen

Thanks

> From Access' point of view, SendObject either succeeds (the email goes) or
> fails (it did not go.)
[quoted text clipped - 72 lines]
> >> >> > the
> >> >> > email sending if i change my mind at the last minute
Clois Beckwith - 19 Sep 2006 15:14 GMT
I have a problem, not email related, but related to the "Save Action
Cancelled" when I open up one form through a button and when I close one form
through a close button. There is no Event Procedures on the opening or
loading of the forms. There are no "DoCmd.save" on any event procedures. Anuy

> Add error-handling to the procedure that contains this line, and trap error
> 2501.
[quoted text clipped - 28 lines]
> >
> > Thanks
Kevin Jameson - 19 Sep 2006 15:32 GMT
you cant do this with microsoft access 2003

you must upgrade to access 20004 by clicking here:
http://www.ammara.com/access_image_faq/access_loading_image_dialog.html

HTH

Kevin
>I have a problem, not email related, but related to the "Save Action
> Cancelled" when I open up one form through a button and when I close one
[quoted text clipped - 40 lines]
>> >
>> > Thanks
Clois Beckwith - 19 Sep 2006 16:02 GMT
Kevin, can you clarify what I can't do in  Access 2003, I am confused.

> you cant do this with microsoft access 2003
>
[quoted text clipped - 48 lines]
> >> >
> >> > Thanks
Dirk Goldgar - 19 Sep 2006 17:04 GMT
> Kevin, can you clarify what I can't do in  Access 2003, I am confused.

Please ignore "Kevin's" message.  He's posting the same completely bogus
message in reply to many different newsgroup questions, apparently in a
fit of pique.

There is no Access 20004, or even 2004,  and the link is to a completely
irrelevant page.

Signature

Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)

Clois Beckwith - 19 Sep 2006 18:02 GMT
This issue is "Resolved"   Thanks to all who provided very good information.

> > Kevin, can you clarify what I can't do in  Access 2003, I am confused.
>
[quoted text clipped - 4 lines]
> There is no Access 20004, or even 2004,  and the link is to a completely
> irrelevant page.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.