Full Version: Email Issue In Access 2007
UtterAccess Discussion Forums > Microsoft® Access > Access Reports
River34
I am attempting to send an email using the following lines of code -- both fail:

Private Sub Export_Click()
On Error GoTo Err_Export_Click

' DoCmd.SendObject acReport, "rptProject", acFormatPDF, Email_TO, , , "Sample Email Subject", , False
DoCmd.SendObject acReport, "rptProject", acFormatPDF, "RealEmailAddress@yahoo.com", , , "Sample Email Subject", , False

Exit_Export_Click:
Exit Sub

Err_Export_Click:
MsgBox Err.Description
Resume Exit_Export_Click

End Sub

My email uses Outlook Web Access and I am running over a wireless connection. When the code runs I get prompted for my email password. Sometimes I get prompted over and over then the email appears to have been sent but wasn't. Sometimes I am not prompted. Problem is that email is NEVER actually sent. Anyone have any suggestions?

The prompts are attached.



theDBguy
Hi,

Since you are not really using an email client, you might have better luck using CDO method.

Check the Code Archive for a demo by David Marten (cheekybuddha).

Just my 2 cents... 2cents.gif
River34
Will take a look. Thanks for the fast lead, DB. This process is going to get very complex with variables and attachements, etc. and I can't very well code it and not be able to check and debug.
theDBguy
Hi,

Yes, if you're talking "attachments," then you can definitely not use SendObject() for that.

Good luck! Let us know how it goes...
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.