Kevin:
A couple possibilities include error trapping or handling the Outlook
security warning message. I found two errors that occur when canceling the
email (there may be others). Error 2293 when canceling the Outlook
security warning and Error 2501 when closing the actual Outlook email.
Other errors would be handled in a similar fashion. An example of simple
error trapping might be:
Function SendEmail()
On Error GoTo Errorhandler
DoCmd.SendObject objecttype:=acSendNoObject, ObjectName:=strDocName,
outputformat:=acFormatHTML, To:=stremail, Subject:=strsubject,
MessageText:=strmessage
Exit_Function:
Exit Function
Errorhandler:
If Err.Number = 2293 Or Err.Number = 2501 Then Resume Next
'Other error handling here.
End Function
Regarding handling the Outlook security warning, I believe you can find more
information here:
http://www.outlookcode.com/d/sec.htm#sendkeys
--
David Lloyd
MCSD .NET
http://LemingtonConsulting.com
This response is supplied "as is" without any representations or warranties.
"kevcar40" <ke******@btinternet.com> wrote in message
news:11**********************@g43g2000cwa.googlegr oups.com...
Hi
i have the following code under a afterupdate function
DoCmd.SendObject objecttype:=acSendNoObject, ObjectName:=strDocName,
outputformat:=acFormatHTML, To:=stremail, Subject:=strsubject,
MessageText:=strmessage
this creates the email and opens outlook
problem is if the user clicks the X in outlook in crashes the code
is it possible to either send the email automatically
or disable the X in outlook
thanks in advance
kevin