T
TheRingLord.com
I can send an email from VB using the following code:
Private Sub SendEmail_Click()
Set myOlApp = CreateObject("Outlook.Application")
Set myItem = myOlApp.CreateItem(olMailItem)
myItem.Display '-- Optional --
myItem.To = [oemail]
myItem.Subject = "Chainmail Supply Order " & [orderid]
myItem.Body = "Thank you for ordering from The Ring Lord."
'*** I put many more lines here wiht the myItem.Body="" and they work great.
i have removed them for clarity of the question.
'****This is where the problem is I am asking about ****
myItem.Body = myItem.Body & "The Ring Lord"
myItem.Save '-- It's advised to save items before
' adding attachments.
AppActivate myItem
SendKeys ("%s")
DoCmd.Close
End Sub
This code is linked to from a a customer order form.
I can add any number of items from the parent form using the myItem.Body
statement. For example the address and name of the person being shipe dto,
what they owe etc.
I need to then add the items in the order to the email. When I go to add the
list of items it only shows the first one from the child data. I probably
need a loop or something to go thru the records in the child form.
The resulting email should look like this:
Order Number: 14819 (this is the parent form data)
The Customer is:
name and address info
Products Ordered: (this is the subfrom data)
Product name , qty and price
Private Sub SendEmail_Click()
Set myOlApp = CreateObject("Outlook.Application")
Set myItem = myOlApp.CreateItem(olMailItem)
myItem.Display '-- Optional --
myItem.To = [oemail]
myItem.Subject = "Chainmail Supply Order " & [orderid]
myItem.Body = "Thank you for ordering from The Ring Lord."
'*** I put many more lines here wiht the myItem.Body="" and they work great.
i have removed them for clarity of the question.
'****This is where the problem is I am asking about ****
myItem.Body = myItem.Body & "The Ring Lord"
myItem.Save '-- It's advised to save items before
' adding attachments.
AppActivate myItem
SendKeys ("%s")
DoCmd.Close
End Sub
This code is linked to from a a customer order form.
I can add any number of items from the parent form using the myItem.Body
statement. For example the address and name of the person being shipe dto,
what they owe etc.
I need to then add the items in the order to the email. When I go to add the
list of items it only shows the first one from the child data. I probably
need a loop or something to go thru the records in the child form.
The resulting email should look like this:
Order Number: 14819 (this is the parent form data)
The Customer is:
name and address info
Products Ordered: (this is the subfrom data)
Product name , qty and price