Here is some code I have saved from somewhere that might be of some
help ----
There is a subform within an order form that holds what product were ordered
with the order number, quantity and price. The code below gets the
information from the subform to
apear with in the body of the email text.
'This first part sets up to allow you to read the details of the items
ordered
Dim CRS1 As ADODB.Recordset
Dim strSQL As String
Set CRS1 = New ADODB.Recordset
strSQL = "SELECT * FROM tblOrderDetails WHERE OrderID =" &
Forms!frmFormName!OrderID
'This part begins to build the body of the email
strBody = "Dear " & Forms!frmFormName!FirstName & ": " & vbCrLf &
vbCrLf
strBody = strBody & "Your order for the following items has been
receieved and has been shipped via "
strBody = strBody & Forms!frmFormName!ShipVia & " on " &
Forms!frmName!ShipDate & "."
strBody = strBody & vbCrLf & vbCrLf
'This part retrieves each item ordered and adds it to the body of the
email
CRS1.Open strSQL, CurrentProject.Connection, adOpenKeySet,
adLockReadOnly
While Not CRS1.EOF
strBody = strBody & CRS1.Fields("Qty") & " " &
CRS1.Fields("Item") & " @ " & CRS1.Fields("Price") & " Total: " & _
CRS1.Fields("Price") * CRS1.Fields("Qty") & vbCrLf
CRS1.MoveNext
Wend
CRS1.Close
Set CRS1 = Nothing
Note: The vbCrLf you will see in this code performs a Carriage Return
and Line Feed - like pressing Enter on your keyboard.
PC Datasheet
Providing Customers A Resource For Help With Access, Excel And Word
Applications
(e-mail address removed)