HTML in Rich text field adds ">" (1 Viewer)

Zakraket

Registered User.
Local time
Today, 06:31
Joined
Feb 19, 2013
Messages
88
I'm trying to output some logging to a form with a Rich text textbox

This is what the form is displaying:
14:16:32: check OK: 500<10000andS235='s460'>
14:16:32: check OK: 500<10000andS235='s355'>
14:16:32: check failed:too short 500<1000231231 >
14:16:32: Ready ...

There is some coloring in the text but I'm not display that here (copy/paste of the textbox)

This is the HTML behind it (? txtbox in imm.window):
14:16:32:&nbsp<font color=black>check OK: 500<10000andS235='s460'</font><br />14:16:32:&nbsp<font color=black>check OK: 500<10000andS235='s355'</font><br />14:16:32:&nbsp<font color=red><strong>check failed:too short 500<1000231231 </strong></font><br />14:16:32:&nbsp<font color=green><strong>Ready ... </strong></font><br />


The problem is in the red > that are added to each line. I have no clue where they are coming from, in fact: they are NOT in the HTML.

When I display this piece of HTML in IE I don't get the red > behind each line.

I have tried to use <p> of <div> instead of <br/> but that makes no difference

The code that I use:
Code:
Forms!frm_Calculationlog.txtmsg = Forms!frm_Calculationlog.txtmsg & "<div>" & _
                                    Format(Now(), "hh:nn:ss") & ":&nbsp" & _
                                    IIf(strColor <> "", "<font color=" & strColor & ">", "") & IIf(booBold, "<strong>", "") & strMessage & _
                                    IIf(booBold, "</strong>", "") & IIf(strColor <> "", "</font></div>", "")

I can assure you that the > is NOT in the strMessage ... :confused: f.e. this is the ouput of strMessage on the first line:
500 <10000 and 'S235' ='s460'

strColor is a string in which I can set a color ("red", "blue")
booBold is a boolean with which I can set text to bold

Anybody have a clue?
 

Jibbadiah

James
Local time
Today, 14:31
Joined
May 19, 2005
Messages
282
Sorry... updated, cos pasted the wrong code

Code:
Public Function Testing()
Const booBold As Boolean = True
Dim strText As String
Dim strColor As String
Dim strMessage As String

strColor = "black"
strMessage = "check failed:too short 500<1000231231"

strText = "<div>" & Format(Now(), "hh:nn:ss") & ":&nbsp" & IIf(strColor <> "", "<font color=" & strColor & ">", "") & IIf(booBold, "<strong>", "") & strMessage & IIf(booBold, "</strong>", "") & IIf(strColor <> "", "</font></div>", "")

Debug.Print strText
End Function

Which gives this html - <div>15:56:13:&nbsp<font color=black><strong>check failed:too short 500<1000231231</strong></font></div>

... long story short... if you've output the html as as you state then it is correct because it displays correctly on http://htmledit.squarefree.com/

I can't see the problem... sorry.
 
Last edited:

Zakraket

Registered User.
Local time
Today, 06:31
Joined
Feb 19, 2013
Messages
88
Yes, it displays correctly

Just tested a bit more:
Exact html-code from the textbox:
<div>16:26:15:&nbsp<font color=blue><strong>Start ... </strong></font></div><div>16:26:15:&nbsp<font color=black> check OK: 10000=0</font></div><div>16:26:15:&nbsp<font color=black> check OK: 'S235'='""'</font></div><div>16:26:15:&nbsp<font color=red><strong> check failed:not allowed 10000>=10000ANDS235='s235'</strong></font></div><div>16:26:15:&nbsp<font color=green><strong>Ready ... </strong></font></div>

Access displays a red > behind line 3, squarefree HTML editor doesn't.

Maybe a little bug in Richtextfields in Access (version 2013 btw)?
 

Jibbadiah

James
Local time
Today, 14:31
Joined
May 19, 2005
Messages
282
Your message with a less than operator is being treated as an html tag.
I guess the red ">" is telling you that you have an incomplete tag. Is there someway to enclose that message in double quotes or something?
 

Zakraket

Registered User.
Local time
Today, 06:31
Joined
Feb 19, 2013
Messages
88
Yes, that's it! So obvious afterwards :)

Changing
strMessage
to
Replace(strMessage, "<", "'<'")
was enough to fix the problem

Mucho thanks
 

Users who are viewing this thread

Top Bottom