Need help with emailing a report in access

P

Pacotx

Hi,
I have become a ebay seller and every time I sell something I put all of the
info into a Access form. But what I want to do Is to be able to email a
invoice. I want the report to be text in the body of the email and a field to
be were the email address is sent. I have looked all though Microsoft help
center and I didn't get anything I wanted.
Here is a example of what I would like to send:
___________________________________________________________
To: [email address]@[host].[web]
Title: Your invoice from Andrew

BODY:
[ebay ID],
Thank you for your purchase of a [item].
We hople the transaction goes well!

Invoice:
Price: [price]
Shipping: [shipping]
insurance: [insurance] _________________________
Total: [total]________
___________________________________________________________

Could someone help me?? If there is a way can you also teach me how to do
news letters as well?
Thanx for your time,
Andrew :)
P.S. I know that there is a insert object that you can email, but I don't
thing you can send it to different people, or have it show up as text and not
a file.
 
F

freakazeud

Hi,
if you are doing this from the form where you entered the values then you
can just reference the form controls holding the correct values. The
simplest, but also most limited method of email automation is the sendobject
method. This little sample demonstrades how to generate an outlook email from
the current form and reference form controls in the email to/subject/body of
the email:

Dim strToWhom As String
Dim strMsgBody As String
Dim strSubject As String

strSubject = "Your Subject goes here!"

strToWhom = Me!ContactEMail 'control holding email address

strMsgBody = "Your Body text goes here or you can reference controls from
your form as well e.g.:" & Me.FirstControl & " " & Me.SecControl & " " &
Me.ThirdControl & "and so on and on!"

DoCmd.SendObject , , , strToWhom,, , strSubject, strMsgBody, True

If you are not doing this from the form where you lookup or enter the
information then you could create a query which filters out the info you need
and then use the query values in the email body instead. Some good samples of
this method can be found here
http://www.utteraccess.com/forums/s...=m&olderval=&oldertype=#Post1054969&bodyprev=

HTH
Good luck
--
Oli-S
Admin Specialist & Computer Science Major @ UMD - Go Terps - :)
http://www.oli-s.de


Pacotx said:
Hi,
I have become a ebay seller and every time I sell something I put all of the
info into a Access form. But what I want to do Is to be able to email a
invoice. I want the report to be text in the body of the email and a field to
be were the email address is sent. I have looked all though Microsoft help
center and I didn't get anything I wanted.
Here is a example of what I would like to send:
___________________________________________________________
To: [email address]@[host].[web]
Title: Your invoice from Andrew

BODY:
[ebay ID],
Thank you for your purchase of a [item].
We hople the transaction goes well!

Invoice:
Price: [price]
Shipping: [shipping]
insurance: [insurance] _________________________
Total: [total]________
___________________________________________________________

Could someone help me?? If there is a way can you also teach me how to do
news letters as well?
Thanx for your time,
Andrew :)
P.S. I know that there is a insert object that you can email, but I don't
thing you can send it to different people, or have it show up as text and not
a file.
 
P

Pacotx

Thanx for you help.
I would probly use a query so how do I set that up? would I be able to put
pictures in the body for like a newsletter? Were the email address is sent is
it possible to be a field?
Thanx,
Andrew

freakazeud said:
Hi,
if you are doing this from the form where you entered the values then you
can just reference the form controls holding the correct values. The
simplest, but also most limited method of email automation is the sendobject
method. This little sample demonstrades how to generate an outlook email from
the current form and reference form controls in the email to/subject/body of
the email:

Dim strToWhom As String
Dim strMsgBody As String
Dim strSubject As String

strSubject = "Your Subject goes here!"

strToWhom = Me!ContactEMail 'control holding email address

strMsgBody = "Your Body text goes here or you can reference controls from
your form as well e.g.:" & Me.FirstControl & " " & Me.SecControl & " " &
Me.ThirdControl & "and so on and on!"

DoCmd.SendObject , , , strToWhom,, , strSubject, strMsgBody, True

If you are not doing this from the form where you lookup or enter the
information then you could create a query which filters out the info you need
and then use the query values in the email body instead. Some good samples of
this method can be found here:
http://www.utteraccess.com/forums/s...=m&olderval=&oldertype=#Post1054969&bodyprev=

HTH
Good luck
--
Oli-S
Admin Specialist & Computer Science Major @ UMD - Go Terps - :)
http://www.oli-s.de


Pacotx said:
Hi,
I have become a ebay seller and every time I sell something I put all of the
info into a Access form. But what I want to do Is to be able to email a
invoice. I want the report to be text in the body of the email and a field to
be were the email address is sent. I have looked all though Microsoft help
center and I didn't get anything I wanted.
Here is a example of what I would like to send:
___________________________________________________________
To: [email address]@[host].[web]
Title: Your invoice from Andrew

BODY:
[ebay ID],
Thank you for your purchase of a [item].
We hople the transaction goes well!

Invoice:
Price: [price]
Shipping: [shipping]
insurance: [insurance] _________________________
Total: [total]________
___________________________________________________________

Could someone help me?? If there is a way can you also teach me how to do
news letters as well?
Thanx for your time,
Andrew :)
P.S. I know that there is a insert object that you can email, but I don't
thing you can send it to different people, or have it show up as text and not
a file.
 
F

freakazeud

Hi,
the sendobject method can only send plain text emails...so you wouldn't be
able to use that to send images. You would probably need to use automation
code to create an HTML email. Check this sample for a good start:
http://www.utteraccess.com/forums/s...u=64822&Zd=l&Zn=&Zt=b&Zs=b&Zy=#Post708118&Zp=
For the email address part check the earlier provided sample.
HTH
Good luck
--
Oli-S
Admin Specialist & Computer Science Major @ UMD - Go Terps - :)
http://www.oli-s.de


Pacotx said:
Thanx for you help.
I would probly use a query so how do I set that up? would I be able to put
pictures in the body for like a newsletter? Were the email address is sent is
it possible to be a field?
Thanx,
Andrew

freakazeud said:
Hi,
if you are doing this from the form where you entered the values then you
can just reference the form controls holding the correct values. The
simplest, but also most limited method of email automation is the sendobject
method. This little sample demonstrades how to generate an outlook email from
the current form and reference form controls in the email to/subject/body of
the email:

Dim strToWhom As String
Dim strMsgBody As String
Dim strSubject As String

strSubject = "Your Subject goes here!"

strToWhom = Me!ContactEMail 'control holding email address

strMsgBody = "Your Body text goes here or you can reference controls from
your form as well e.g.:" & Me.FirstControl & " " & Me.SecControl & " " &
Me.ThirdControl & "and so on and on!"

DoCmd.SendObject , , , strToWhom,, , strSubject, strMsgBody, True

If you are not doing this from the form where you lookup or enter the
information then you could create a query which filters out the info you need
and then use the query values in the email body instead. Some good samples of
this method can be found here:
http://www.utteraccess.com/forums/s...=m&olderval=&oldertype=#Post1054969&bodyprev=

HTH
Good luck
--
Oli-S
Admin Specialist & Computer Science Major @ UMD - Go Terps - :)
http://www.oli-s.de


Pacotx said:
Hi,
I have become a ebay seller and every time I sell something I put all of the
info into a Access form. But what I want to do Is to be able to email a
invoice. I want the report to be text in the body of the email and a field to
be were the email address is sent. I have looked all though Microsoft help
center and I didn't get anything I wanted.
Here is a example of what I would like to send:
___________________________________________________________
To: [email address]@[host].[web]
Title: Your invoice from Andrew

BODY:
[ebay ID],
Thank you for your purchase of a [item].
We hople the transaction goes well!

Invoice:
Price: [price]
Shipping: [shipping]
insurance: [insurance]
_________________________
Total: [total]________
___________________________________________________________

Could someone help me?? If there is a way can you also teach me how to do
news letters as well?
Thanx for your time,
Andrew :)
P.S. I know that there is a insert object that you can email, but I don't
thing you can send it to different people, or have it show up as text and not
a file.
 
C

Crossh

I am trying to automatically send an email from a report that includes the
report in the body of the text as an image, not an attachment. I downloaded
your mdb and copied your code and modified it slightly for testing.

Dim olApp As Outlook.Application
Dim objMail As Outlook.MailItem
Set olApp = Outlook.Application
'Create e-mail item
Set objMail = olApp.CreateItem(olMailItem)

With objMail
'Set body format to HTML
.To = "(e-mail address removed)"
.CC = "(e-mail address removed)"
.Subject = "TEST"
.BodyFormat = olFormatHTML
.HTMLBody = "<HTML><BODY>" & "TESTBODY" & "</BODY></HTML>"
.Display
End With

But I have two questions:
1- How do I get it to automatically send?
2- How do I insert the report as an image?
 

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