Send Email with File Attachment

S

Samuel

Hi

Is it possible to send an email with file attachments using the SendObject
Action? Alternatively is there another method to do that?

Thank you,
Samuel
 
G

Guest

Hi Samuel,

It is certainly possible to send (1) attachment using SendObject, as long as
the attachment you want to send is an object (table, query, etc.) within your
database.

If you are using Outlook (not Outlook Express), you can use code shown on
page 17 of my "Access Links.doc" Word document. You are welcome to download a
zipped copy from here:

http://home.comcast.net/~tutorme2/samples/accesslinks.zip

Access MVP Arvin Meyer has some code samples available for Outlook as well:

http://www.datastrat.com/Code1.html
(See "OutlookEmail.txt" and "MultipleMail.txt")


Tom Wickerath
Microsoft Access MVP
https://mvp.support.microsoft.com/profile/Tom
http://www.access.qbuilt.com/html/expert_contributors.html
__________________________________________
 
S

Samuel

All I want is to send a report with a picture but the picture disappears
when I use the email option
 
R

Rick Brandt

Samuel said:
All I want is to send a report with a picture but the picture
disappears when I use the email option

The only export format that supports graphics is the Snapshot format and the new
PDF option in Access2007.
 
G

Guest

Hi Samuel,

If you can send the attachment in the Microsoft Access Snapshot (*.snp) file
format, then you should be home free. However, this would require that the
receipient has the free viewer utility installed on their Windows-based PC.
Here is an example of how to do this:

DoCmd.SendObject acReport, "Report Name", OutputFormat:=acFormatSNP, _
To:="Email Address", Subject:="Email Subject", EditMessage:=True

This thread, from Dec., 2004, gives more details:
http://groups.google.com/group/micr..._frm/thread/2f52f437605face7/3cb254d13a623323

I think you can also programmatically export to a .PDF file, and then use
code for Outlook to send this file. You can try using Stephen Leban's Report
to PDF method to create the .PDF file, and then use my code (or Arvin's code)
to send the file using Outlook (not Outlook Express).

Report to PDF
http://www.lebans.com/reporttopdf.htm


Tom Wickerath
Microsoft Access MVP
https://mvp.support.microsoft.com/profile/Tom
http://www.access.qbuilt.com/html/expert_contributors.html
__________________________________________
 
I

IRS Intern

Warning; Tom Wickerath is a cry baby database pussy and you shouldn't
listen to him for anything

go and talk to someone that knows SQL Server, kids
 
T

tina

MVP Tom Wickerath's advice and suggestions stand or fall on their own
merits, as do those of everyone else who posts replies in these newsgroups.
the exception, of course, are personal attacks - which do not point out
flaws in the posted advice or suggestions, and offer valid corrections or
fixes or alternatives, but are merely unpleasant to read. in those cases, my
suggestion is to block the sender, so as to avoid wasting time reading these
types of posts.
go and talk to someone that knows SQL Server, kids

my advice is that this suggestion is not useful, because this newsgroup is
devoted to MS Access. so one must assume that the post-er is using Access,
but not in conjunction with SQL server - or that the origin of the data has
no bearing on the question - unless s/he specifically includes it in the
post...and indeed the original and subsequent posts in this thread do not
include SQL server in any way that i can see.

hth
 
I

IRS Intern

Tom Wickerath is a ****ING PUSSY

he doesn't know how to use SQL Server; or else he would surely promote
ADP


ADP is vastly superior
no more linking connection strings

import problems?

NOT WITH SQL SERVER

MDB cry babies can **** yourself
 
S

Susie DBA [MSFT]

there is 'no such things' as access without SQL Server

sorry

it doesn't exist any longer; it has been reccomended to move to SQL
Server for a decade
 
J

JeffG

Tom -

You reference your code or Arvin's code to send the PDF file in
Outlook....can you elaborate? I've been trying to find out how to send a
PDF after using Lebans ReportToPDF, but have been unsuccessful. I want to
automate the whole process, with no user intervention or having to attach a
file in an email message.

Thanks.

Jeff G
 
T

Tony Toews [MVP]

JeffG said:
You reference your code or Arvin's code to send the PDF file in
Outlook....can you elaborate? I've been trying to find out how to send a
PDF after using Lebans ReportToPDF, but have been unsuccessful. I want to
automate the whole process, with no user intervention or having to attach a
file in an email message.

Microsoft Access Email FAQ
http://www.granite.ab.ca/access/email.htm

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
 
J

JeffG

Tom -

That's along the lines of what I want to do, but more specifically, I want
to run the ReportToPDF, which generates the PDF, and send the file that was
just created without actually saving it to the disk. In your code, it looks
like it's using wildcards to send the files. I want to send a single file.
The process map would be like:

1. Generate the PDF using ReportToPDF
2. Programmatically set up an email message with that PDF as the
attachment, with some items filled in already (i.e. SendTo, Message Body,
and attachment).
3. Leave no remnants of the snp or pdf files.

Like I said, I have both the ReportToPDF and your SendMail modules in my
database, but can't figure out how to get them to do what I want.

Thanks.

Jeff
 
P

Peter Hibbs

Jeff

I have combined the e-mail code from Tom and the ReportToPDF code from
Stephen into a single module. You can import the module into your
project and then to email a report as a PDF file you can just call a
single sub-routine which does everything automatically (in exactly the
way you described).

If you would like a copy of the code (providing Tom or Stephen do not
object) just email me at (e-mail address removed) (leave off
the NOSPAM bit) and I will send it on.

Peter Hibbs.
 
G

Guest

Hi Peter,

I have no objections, and I'm pretty sure that Stephen would be fine with it
too. Thank You for taking this inititive!

Jeff: In your last reply, you wrote:

"That's along the lines of what I want to do, but more specifically, I
want
to run the ReportToPDF, which generates the PDF, and send the file that
was just created without actually saving it to the disk."

I don't think this is possible to use the ReportToPDF functionality, without
first writing the file to the hard drive, if only as a temporary copy. My
code is designed to send files that can be found on the hard drive. One could
add code to delete the .pdf file after having sent it, and this would
probably be fairly reliable, but, if Access happened to crash for some reason
after writing the file, but before the deletion code was run, then you could
end up with the .pdf file remaining on the hard drive. Depending on the
method that you are using for sending e-mail, you would likely end up with a
copy on the hard drive anyways, in the Sent Items folder of Outlook.

You might also want to look into using Win2PDF (http://win2pdf.com). It can
be programmed using VBA code. Another Access MVP, who uses this product, is
very happy with it.


Tom Wickerath
Microsoft Access MVP
https://mvp.support.microsoft.com/profile/Tom
http://www.access.qbuilt.com/html/expert_contributors.html
__________________________________________
 

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

Top