access vba html for outlook email tables not correct

access vba
outlook html in access vba

I was told that i do not have the correct opening and closing of "/tables"
but the email looks fine ?

strhtml = "<HTML><Body><table border='1' width='50%'><tr><th>Sku</th><th>PRODUCT_DESCRIPTION</th><th>QTY</th>" & _
"<th>TARGET_PRICE</th><th>COMPETITOR_PRICE</th><th>TARGET_PRICE_PROFITABILITY</th><th>CURRENT_PRICE</th></tr>"




this is for each individual Sku line


If gp >= "25.00" Then
MAILBODY = MAILBODY & "<tr><td>" & rst("SKU") & "</td><td>" & rst("PRODUCT_DESCRIPTION") & "</td><td>" & _
        rst("QTY") & "</td><td>" & Format(rst("TARGET_PRICE"), "Currency") & "</td><td>" & Format(rst("COMPETITOR_PRICE"), "Currency") & _
        "</td><td bgcolor=""Green"">" & "Profitable" & "</td><td>" & Format(rst("CURRENT_PRICE"), "Currency") & "</td></tr>"
       End If

' yellow
If gp >= "20.00" And gp <= "24.99" Then
                MAILBODY = MAILBODY & "<tr><td>" & rst("SKU") & "</td><td>" & rst("PRODUCT_DESCRIPTION") & "</td><td>" & _
        rst("QTY") & "</td><td>" & Format(rst("TARGET_PRICE"), "Currency") & "</td><td>" & Format(rst("COMPETITOR_PRICE"), "Currency") & _
        "</td><td bgcolor=""Yellow"">" & "Low Profitability" & "</td><td>" & Format(rst("CURRENT_PRICE"), "Currency") & "</td></tr>"
       End If




'Red Light
               If gp >= "15.00" And gp <= "19.99" Then
           MAILBODY = MAILBODY & "<tr><td>" & rst("SKU") & "</td><td>" & rst("PRODUCT_DESCRIPTION") & "</td><td>" & _
        rst("QTY") & "</td><td>" & Format(rst("TARGET_PRICE"), "Currency") & "</td><td>" & Format(rst("COMPETITOR_PRICE"), "Currency") & _
        "</td><td bgcolor=""red"">" & "Not Profitable" & "</td><td>" & Format(rst("CURRENT_PRICE"), "Currency") & "</td></tr>"
               End If
        ' RSVP SUBFORM
        'Red Light under 15
               If gp <= "14.99" Then
           MAILBODY = MAILBODY & "<tr><td>" & rst("SKU") & "</td><td>" & rst("PRODUCT_DESCRIPTION") & "</td><td>" & _
        rst("QTY") & "</td><td>" & Format(rst("TARGET_PRICE"), "Currency") & "</td><td>" & Format(rst("COMPETITOR_PRICE"), "Currency") & _
        "</td><td bgcolor=""red"">" & "Not Profitable" & "</td><td>" & Format(rst("CURRENT_PRICE"), "Currency") & "</td></tr>"
               End If




mybody = "Please Review the request and advise if you support.<br><br>"
   
   mybody = mybody & "Request #: " & price_escNum & " <br>" & _
    "Quote #: " & esc_Quote & "<br>" & _
    "point #: " & POINTID & "<br>" & _
    "Price Requested Until : " & PRICE_REQUESTED & "<br>" & _
    "Account #: " & esc_AccountNumber & "<br>" & _
    "Account Name: " & esc_AccountName & "<br>" & _
    "Seller Name: " & SELLER_NAME & "<br>" & _
    "DSM Name: " & DSM_NAME & "<br>" & _
    "Opportunity Value: " & Format(OPPORTUNITY_VALUE, "Currency") & "<br>" & _
    "Rolling 12 Sales: " & Format(ROLLING_12_SALES, "Currency") & "<br>" & _
    "Competitor: " & COMPETITOR_NAME & "<br><br>"



mybody2 = "</table><p>Reason For Escalation:" & REASON_ESCALATION & "<br><br>"
    mybody2 = mybody2 & "</table><p>Sincerely,<br><br>"
    mybody2 = mybody2 & "The CSP Quotations Team.</p>"



mybody3 = "</table><p><b>Additional Approval or Rejection Comments:   <b><br><br></p>"

Open in new window

LVL 3
FordraidersAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Bill PrewCommented:
Normally I would expect to see <table> tags before the start of the table, is that missing for a reason?

And how are these substrings assembled to build the actual email HTML body?


»bp
0
FordraidersAuthor Commented:
No, just chopped code put together..
0
Bill PrewCommented:
And how are these substrings assembled to build the actual email HTML body?


»bp
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Luke ChungPresidentCommented:
From our experience how Outlook displays an HTML message is different from how a browser displays the same data. It has nothing to do with Access. For instance, float  and padding around graphics are very different. Tables are also impacted. And of course, if someone views the same message in gmail, Yahoo, etc., it can also be different.
0
FordraidersAuthor Commented:
And how are these substrings assembled to build the actual email HTML body?
Yes
0
Bill PrewCommented:
And how are these substrings assembled to build the actual email HTML body?
Yes
Not what I was looking for, I was looking for more information on how these strings of HTML that you are building are combined / concatenated to end up in an email body.  What order, are there other strings, etc?  Basically everything else that happens before you set .HTMLbody in the email.


»bp
0
FordraidersAuthor Commented:
They end up here.
.BodyFormat = olFormatHTML
     .HTMLBody = mybody & MAILBODY & mybody3 & user_link_to_approve & user_link_to_reject & mybody2
0
Bill PrewCommented:
Okay, that's helpful, so working from that, it ends up that the basic structure of your HTML will look like the following.  That should render properly in most browsers, but Outlook and other email clients can be a little selective.  It does appear that there are some areas that need improvement though.  I think the second version below should be more like what you shoot for.  A few notes:

  • Move the non table text before the <table> start.
  • Remove the 2 extra </table> closings toward the bottom, you have 3 currently.
  • The last <b> should be a </b> to close the bolding.

<HTML>

<Body>
    <table border='1' width='50%'>
        <tr>
            <th>Sku</th>
            <th>PRODUCT_DESCRIPTION</th>
            <th>QTY</th>
            <th>TARGET_PRICE</th>
            <th>COMPETITOR_PRICE</th>
            <th>TARGET_PRICE_PROFITABILITY</th>
            <th>CURRENT_PRICE</th>
        </tr>
        Please Review the request and advise if you support.
        <br>
        <br> Request #: price_escNum
        <br> Quote #: esc_Quote
        <br> point #: POINTID
        <br> Price Requested Until : PRICE_REQUESTED
        <br> Account #: esc_AccountNumber
        <br> Account Name: esc_AccountName
        <br> Seller Name: SELLER_NAME
        <br> DSM Name: DSM_NAME
        <br> Opportunity Value: OPPORTUNITY_VALUE
        <br> Rolling 12 Sales: ROLLING_12_SALES
        <br> Competitor: COMPETITOR_NAME
        <br>
        <br>
        <tr>
            <td>SKU</td>
            <td>PRODUCT_DESCRIPTION</td>
            <td>
                QTY</td>
            <td>TARGET_PRICE</td>
            <td>COMPETITOR_PRICE
            </td>
            <td bgcolor="Green">Profitable</td>
            <td>CURRENT_PRICE</td>
        </tr>
        <tr>
            <td>SKU</td>
            <td>PRODUCT_DESCRIPTION</td>
            <td>
                QTY</td>
            <td>TARGET_PRICE</td>
            <td>COMPETITOR_PRICE
            </td>
            <td bgcolor="Green">Profitable</td>
            <td>CURRENT_PRICE</td>
        </tr>
    </table>
    <p><b>Additional Approval or Rejection Comments:   <b><br><br></p>
</table><p>Reason For Escalation:REASON_ESCALATION<br><br>
</table><p>Sincerely,<br><br>
The CSP Quotations Team.</p>
</body>
</html>

Open in new window

<HTML>
<Body>
Please Review the request and advise if you support.
<br>
<br> Request #: price_escNum
<br> Quote #: esc_Quote
<br> point #: POINTID
<br> Price Requested Until : PRICE_REQUESTED
<br> Account #: esc_AccountNumber
<br> Account Name: esc_AccountName
<br> Seller Name: SELLER_NAME
<br> DSM Name: DSM_NAME
<br> Opportunity Value: OPPORTUNITY_VALUE
<br> Rolling 12 Sales: ROLLING_12_SALES
<br> Competitor: COMPETITOR_NAME
<br>
<br>
<table border='1' width='50%'>
    <tr>
        <th>Sku</th>
        <th>PRODUCT_DESCRIPTION</th>
        <th>QTY</th>
        <th>TARGET_PRICE</th>
        <th>COMPETITOR_PRICE</th>
        <th>TARGET_PRICE_PROFITABILITY</th>
        <th>CURRENT_PRICE</th>
    </tr>
    <tr>
        <td>SKU</td>
        <td>PRODUCT_DESCRIPTION</td>
        <td>
            QTY</td>
        <td>TARGET_PRICE</td>
        <td>COMPETITOR_PRICE
        </td>
        <td bgcolor="Green">Profitable</td>
        <td>CURRENT_PRICE</td>
    </tr>
    <tr>
        <td>SKU</td>
        <td>PRODUCT_DESCRIPTION</td>
        <td>
            QTY</td>
        <td>TARGET_PRICE</td>
        <td>COMPETITOR_PRICE
        </td>
        <td bgcolor="Green">Profitable</td>
        <td>CURRENT_PRICE</td>
    </tr>
</table>
<p><b>Additional Approval or Rejection Comments:   </b><br><br></p>
<p>Reason For Escalation:REASON_ESCALATION<br><br>
<p>Sincerely,<br><br>
The CSP Quotations Team.</p>
</body>
</html>

Open in new window


»bp
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
FordraidersAuthor Commented:
thanks
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
HTML

From novice to tech pro — start learning today.