Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need help showing HTML text in form. 1

Status
Not open for further replies.

socomfort

Technical User
Jul 8, 2005
46
US
Hello,

I have a Access Data Project with a table that stores HTML text in a field. That text is used to populate the body of a email message (MS Outlook). The HTML code is stored in the table as a string (nvarchar in the SQL back end).

Code:
<HTML><BODY><font color=black face="Arial" size=2><br><br><table border=1 cellpadding=3 cellspacing=0><font color=black face="Arial" size=2><font size=3 face="Arial"><b><tr bgcolor=lightblue>

<TD nowrap>FIELD1</TD><TD nowrap>FIELD2</TD><TD nowrap>FIELD3</TD><TD nowrap>FIELD4</TD><TD nowrap>FIELD5</TD></tr></b></font>

<tr><TD nowrap> DATA1 </TD><TD nowrap> DATA2</TD><TD nowrap> </TD><TD nowrap> DATA3</TD><TD nowrap> DATA4 </TD></tr></font></table><br><br> </BODY></HTML>

When it is placed into the email editor, the HTML tags show up correctly and the data is populated in a table.

I have built a form that is used to show the data stored in that table. But rather than have the HTML text show up as code on the form (with the tags, i.e. <tr> </tr>, etc. I'd like for it to show up like it does in the email.

I realize it shows up the way it does in the email message because of the Outlook editor. But I am wondering if MS Access (mdb and adp) has built in functionality that permit this type of view or if this can be done with vba.

I have read some articles about using ASP.net, but I am not sure how to do this. Just wondering if any of you have any suggestions or if you can point me to some resources on this.

thanks,

Ben
 
When you say "I have built a form that is used to show the data stored in that table", do you mean you built a form in Access, or is it a form on an HTML page?

Using VBScript on an ASP page, you could get the code to render as it would appear in the email, while retaining the actual coded output in a hidden form field...

Another possibility is using the Microsoft Web Browser activeX control on your form...you'll find it by clicking on the "more controls" icon on the form toolbox.


Steve
---------------------------------------
IF WebApplicationProgrammer = True Then
ElectronicSheepHerder = True
End If
 
Hi Steve,

Thank you for your response. The form is in an ADP (MS Access). Basically, the HTML text is stored in a field that is used in the body of a email message that the app. builds using CDO (collaborative data objects).

I found the webbrowser control (MSHTML. VBE reference). However, I do not know the syntax to use with the HTML tagged text in order to display it.

I did find a resource on a forum that gave an example on how to display a website url, but not how to display content (like a table) as I previously described.

Q: It seems like the webbrowser control ultimately has to "navigate" to the HTML encoded text. Does that mean that I have to save it to a file first (*.html) somewhere?

Thanks dude,

Ben
 
Hi embryo,

That was very useful. I wound up creating some void functions (private subs w/o return values) that enable me to create a file on the fly and place it in the active directory.

Then I use the WebBrowser control to view the stored data and delete the file when done. It took me a while to figure out, but your guidance pushed me over the top.

Two things I'll work on next are to:
1. persist the file in memory somehow (so I don't have to save it).

2. build the WebBrowser control on the fly so that the form can be completely temporary too (I've run into a snag on this one, but the work-around might be OLEData).

thanks again dude,

Ben
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top