If you wish to add the contents of a record, I suggest you have a form open
that has the record you want to use on it, and a command button linked to the
code listed a little later.
For this demo assume the form has four fields called: Fname, LName, DOB, Sex
The contents of your record for the above fields is: John, Smith, 15th June
1967, Male
in the 'on click' event for your button put the following code.
'Takes the contents of the fields and put them into variables.
Firstname = Form.Fname
Lastname = Form.Lname
DateBirth = Form.DOB
MF = Form.Sex
'Build the body of the E-mail
Bodytext = "First Name: " & Firstname +CHR(13)
Bodytext = Bodytext & "Last Name: " & Lastname +CHR(13)
Bodytext = Bodytext & "Date Of Birth: " & DateBirth +CHR(13)
Bodytext = Bodytext & "Sex: " & MF
Dim objOutlook As Object
Dim objmailItem As Object
'Create the Outlook object
Set objOutlook = CreateObject("Outlook.Application")
'Access a new mail item
Set objmailItem = objOutlook.CreateItem(olmailItem)
'Do things with the E-mail
With objmailItem
..Body = bodytext
..display 'Use .Send if you want the message sent instead of display
End With
Set objmailItem = Nothing
Set objOutlook = Nothing
'End Of Code.....................
What this does is take the contents of the fields, and add them to an Ascii
string called Bodytext.
The code then creates an Outlook object, and using the .body property
inserts the variable Bodytext into the body of the e-mail, creating and Email
looking something like this:
First Name: John
Last Name: Smith
Date Of Birth: 15th June 1967
Sex: Male
All you would need to do is select recipients for the Email, and a subject
line.
These can also be added programatically is you wish using the .to property
and .subject property eg.
..to = "(e-mail address removed)"
..subject = "This is an E-mail"
There are also properties such as .cc, .bcc, .importance,
..readrecieptrequested. which can all be set programatically if required.
Hope this is all clear enough and helps, if not please post again or contact
me.
Neil
www.nwarwick.co.uk