We help IT Professionals succeed at work.

Rich text code for bold ignored on report

Mik Mak
Mik Mak asked
on
In Access 13, I want to use bold text for a section of a control - but the bold codes seen below are simply ignored - italics works fine - very strange. The control is of course set to Rich text :)

="Part 1 <i><b> Bold and italics </b></i> Part 2"
Comment
Watch Question

Thats because its not <b>
The easiest way to figure out the syntax is to create a form, with 2 textboxes.
Set textbox1 to Rich Text.

Then set textbox2 to plain text, and set its controlsource "=Textbox1"

Then do the formatting using the GUI in textbox 1, and see how the syntax looks in textbox2.

It comes out as:
<div>Part 1 <strong><em>Bold Italic</em></strong> Part 2</div>

Open in new window

Mik MakConsultant

Author

Commented:
Thank you for your input - but that sounds strange - every link I have found have mentioned either <b> or <strong>
Daniel PineaultPresident / Owner CARDA Consultants Inc.
Distinguished Expert 2018

Commented:
You have to know that Microsoft's implementation of RTF is very weak and does not respect HTML standards.  You are always best to do as Anders suggests to the the 'format' that Microsoft prescribes to.
While it might look like HTML and has similarities to HTML, its not exactly the same. (Yes, it would probably have made more sense if it was the same syntax...). But don't kill the messenger :)
Mik MakConsultant

Author

Commented:
I understand - just puzzled that every link I can find related to this only mentions either <b> or <strong> - so the correct code must be super secret - or individual per installation...
Do you have an example of such a link? Does it specifically mention Access?
I looked at that link. Nowhere did I find <b> mentioned.
Mik MakConsultant

Author

Commented:
no, that link only mentions <strong>  which doesn't work either :)
Either way, try the method I mentioned in my original post.
Mik MakConsultant

Author

Commented:
But thats on a form - and <div><strong>bold letters</strong></div> as it shows, works fine there - but not on the report :) - but <i> do
Daniel PineaultPresident / Owner CARDA Consultants Inc.
Distinguished Expert 2018

Commented:
What build are you running?

When I did a few quick tests, it all seems to work in both Forms and Reports.

Also the tags that MS seems to us are

Bold -> <strong></strong>
Italic -> <em></em>
Underline -><u></u>
Highlight -><font style="BACKGROUND-COLOR:#FFFF00">d</font>
...
Jeffrey CoachmanMIS Liason
Most Valuable Expert 2012

Commented:
Do you need this formatting in this same "position" in the field, and in every record?

If you just need it in a few records,..you can set the bold and Italic in the table/datasheet view, ...then it will be the same way in the report.
Bold ItalicBold Italic1
JeffCoachman
Try looking at this sample database. Does the report properly bold and italicize the words?
RichTextTest.zip
Mik MakConsultant

Author

Commented:
Hmm, thank you Anders - that works perfectly... - even though the database with the problem is running on 2013/2016 - it's still an mdb file - not accdb -maybe the problem lies here, even though the formatting has nothing to do with any data-structure, as it's a fixed text field
Daniel PineaultPresident / Owner CARDA Consultants Inc.
Distinguished Expert 2018

Commented:
I just tested using an mdb and it all worked fine for me.
Mik MakConsultant

Author

Commented:
So Anders accdb worked fine - but my mdb did'nt - so i tried to convert it to accdb - no change. Then I tried to copy one field from Anders file to the problematic report - and that worked fine... - it turns out the "super special" font the customer is using in the reports don't support bold - goddammit :) Sorry about that guys, but thank you for all the inputs !
Consultant
Commented:
See above
Daniel PineaultPresident / Owner CARDA Consultants Inc.
Distinguished Expert 2018

Commented:
Good catch.  I too would have never of thought of that.
Yes, nice catch. I would not have thought of that either.
Mik MakConsultant

Author

Commented:
Yes, pretty strange - have a nice evening (as it is here in Denmark :))