Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How can data be read into the message body of an email from a form and sent?

Posted on 2003-11-14
8
Medium Priority
?
371 Views
Last Modified: 2006-11-17
Hi Experts

This is a repeat of a question I had asked earlier. I'm still uncertain how to do this. I have increased the points.

I created an Access database to invoice deliveries. I want to be able to send the delivery details contained in a form via email. I want the data to be read into the message body of the email. I don't want to send the form as an attachment. Is this possible? What is the VBA code to perform this task?

The message body of the email must look like the following example:

C1 seafood $10
C2 steak     $12
Subtotal =  $22
Taxes = $2
Total = $24

Currently a report with data read from a form is sent as an attachment automatically on a click of a button. I want the data to be sent in the message body of the email so I can apply a rules wizrd to print the email automatically upon arrival at the destination location. This is the reason why I require the data be in the message body of the text.

Thanks in advance.
0
Comment
Question by:indyng
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 23

Expert Comment

by:heer2351
ID: 9747351
Have a look at this link:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnacc97/html/emldata.asp

it explains how to do what you want.

More email tips can be found here:
http://www.granite.ab.ca/access/email.htm
0
 
LVL 3

Accepted Solution

by:
mccredb earned 2000 total points
ID: 9747367
indyng

Your question is similar to the one posted by Tammi_UK

http://www.experts-exchange.com/Databases/MS_Access/Q_20788626.html

Take a look, it might give you the ideas you need.

Regards,
David
0
 
LVL 3

Expert Comment

by:Ramfublio
ID: 9747681
Here is some sample code (assumes you have a reference to the Outlook library):

Sub CreateEmail()

Dim outlApp As New Outlook.Application
Dim outlEmail As Outlook.MailItem

Set outlEmail = outlApp.CreateItem(olMailItem)

With outlEmail
    .To = "To Address"
    .Body = "C1 seafood $10" & vbNewLine & _
                "C2 steak     $12" & vbNewLine & _
                "Subtotal =  $22" & vbNewLine & _
                "Taxes = $2" & vbNewLine & _
                "Total = $24"
    .Subject = "Your Subject"
    .Display
End With

Set outlApp = Nothing
Set outlEmail = Nothing

End Sub
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Author Comment

by:indyng
ID: 9749895
To mccredb

Is &vbcrlf a carriage return? Thanks
0
 
LVL 23

Expert Comment

by:heer2351
ID: 9750242
vbcrlf is a carriage return (cr) linefeed (lf) and this is equal to vbNewLine or chr(13) & chr(10)
0
 
LVL 1

Author Comment

by:indyng
ID: 9751773
Thanks!!
0
 
LVL 1

Author Comment

by:indyng
ID: 9752192
How do I put in a space between data that is read? Thanks
0
 
LVL 3

Expert Comment

by:mccredb
ID: 9762470
Thanks indyng for the points

to add a space use:  

[first field]  & " " & [second field]

Thanks heer2351 for explaining the vbcrlf constant.    
0

Featured Post

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question