Create Email From Access W/Information From Form or Query in

M

mmatzke

I have designed Databases for many years now, but never attempted this:

I need to know how to create an email with information located in the active
form or off of a query. I would like to have the email automatically
generated with the To Address, The Subject Line and the Body of the Text. I
would like that email to open but not to send until the operator has a chance
to make modifications. (one record per email).
 
C

Carl Rapson

I have designed Databases for many years now, but never attempted this:

I need to know how to create an email with information located in the
active
form or off of a query. I would like to have the email automatically
generated with the To Address, The Subject Line and the Body of the Text.
I
would like that email to open but not to send until the operator has a
chance
to make modifications. (one record per email).

Assuming you're using Outlook, do something like this:

' Declare Outlook variables
Dim Outlook_Object As Object
Dim Outlook_Message As Object
Dim Message_Recipient As Object

' Create a connection to Outlook
Set Outlook_Object = CreateObject("Outlook.Application")
Set Outlook_Message = Outlook_Object.CreateItem(0) ' 0 = Mail item
Set Message_Recipient = Outlook_Message.Recipients.Add("put your
recipient here")
Message_Recipient.Type = olTo

' Body of the email. You can concatenate value from the current record or
from a recordset
Outlook_Message.Body = "put your text here"

' Subject line
Outlook_Message.Subject = "put your subject here"

' Display the email window
Outlook_Message.Display (True)


I've successfully used this method to send emails. I use late binding so
that the version of Outlook doesn't matter; the only problem with this is
that I don't get the benefits of Intellisense with the Outlook objects.

Carl Rapson
 
Top