The following is grabbing text I create from values on my MAIN form.
AND
displaying values from a subform that is in a recordset.
What I need:
I would like to display the whole thing now in html:
BUT
specifically put the data from the subform(rs) into a HTML table to make it look better ?
Dim MyDB As DAO.DatabaseDim rst As DAO.RecordsetDim qd As DAO.QueryDefDim price_escNum As StringDim esc_Quote As StringDim esc_AccountNumber As StringDim esc_AccountName As StringDim SELLER_NAME As StringDim DSM_NAME As String' outlook parameters setprice_escNum = Me!PRICING_ESCALATION_IDesc_Quote = Me!QUOTE_NUMBEResc_AccountNumber = Me!ACCOUNT_NUMBEResc_AccountName = Me!ACCOUNT_NAMESELLER_NAME = Me!SELLER_NAMEDSM_NAME = Me!DSM_NAME' get the subform data nowSet MyDB = CurrentDbSet qd = MyDB.QueryDefs("Query_FOR_HTML")qd.Parameters!ENTERVALUE = [Forms]![Main]![dbo_t_redbook_pricing_escalation_detail_subform]![RBP_MASTER_ID]Set rst = qd.OpenRecordsetWith rst Do While Not .EOF Mailbody = Mailbody & ![SKU] & " | " & ![QTY] & " | " & ![TARGET_PRICE] & vbCrLf .MoveNext LoopEnd With' create the email with the subform dataDim appOutLook As Outlook.Application Dim MailOutLook As Outlook.MailItem Dim strPath As String Dim strFileName As String Set appOutLook = CreateObject("Outlook.Application") Set MailOutLook = appOutLook.CreateItem(olMailItem) With MailOutLook .BodyFormat = olFormatRichText .To = "xxxxell@xxxxxer.com" '.CC = "" '.bcc = "" .Subject = "Action Required - Pricing Escalation #'" & escNum & "'" .Body = "Please review the request and advise if you support." & vbCrLf & " " & vbCrLf & _ "Request #:'" & price_escNum & "'" & vbCrLf & _ "Quote #:'" & esc_Quote & "'" & vbCrLf & _ "Account #:'" & esc_AccountNumber & "'" & vbCrLf & _ "Account Name:'" & esc_AccountName & "'" & vbCrLf & _ "Seller Name:'" & SELLER_NAME & "'" & vbCrLf & _ "DSM Name:'" & DSM_NAME & "'" & vbCrLf & _ "Please Note one or more of the Target Prices is below cost" & vbCrLf _ & " " & vbCrLf _ & Mailbody .SendEnd Withrst.CloseSet rst = NothingMsgBox "done"
That's fairly generic for a problem description <grin>
Remember it ALL has to be syntactically correct HTML
mybody2 = "Sincerely,"
mybody2 = mybody2 & "The CSP Quotations Team."
I don't see any tags in there, do you?
How's about: mybody2 = "<p>Sincerely,<br><br>"
mybody2 = mybody2 & "The CSP Quotations Team.</p>"
Thanks..."cant get it to work"..
Yes, specifically, The "salutation" is embedded in the last cell of the table in the email.
It is not outside the table.
Fordraiders
ASKER
here is a pic
Nick67
Ah.
Well it's HTML.
So if your salutation is in a cell then the part you posted is NOT where the problem lies
The HTML for a table
<table>
<tr><td> Table opens it, tr starts a row, td starts a cell </td></td>
<tr><td> /tr ends a row, /td ends a cell and /table closes it </td></td>
</table>
Before your loop starts you need a
<table>
Your loop running through the recordset is going to create successive
<tr><td>stuff</td></td>
lines. After the loop completes, you need
</table>
I think you don't have the closing table tag or perhaps the final three </td></tr></table> constructed quite right.
Post the code from where "<table>" to "</table>" is
Ok. Only with creating HTML for Outlook these tags are superfluous
<HTML><Body>
Here you open the table
strhtml = "<HTML><Body><table border='1' width='50%'>
And here you are building rows
MAILBODY = MAILBODY & "<tr><td>" ... "</td></tr>"
The VBCrLf is superfluous.
But now, at the end you don't have a closing table tag