Changing text based on criteria in an access report

  • Thread starter Thread starter Mitch
  • Start date Start date
M

Mitch

Hello,

I've got a textbox in a report, some records of which may contain text
within { }. I need to find some way to format only that text (which may
be in the middle of a string) so that it appears underlined and so that
the brackets disappear.

To illustrate, I posted a 5KB graphic here:
http://img219.imageshack.us/img219/3523/jexamplemb2.png

Does anybody have any suggestions or ideas?

Thanks in advance!

Mitch
 
Access 2007 can format the text for you, using standard HTML for the
underlining. Use the Replace() function to swap the braces for the HTML
tags.

Earlier versions of Access cannot display part of a text box differently
than the rest. You could use a rich text control such as this one:
http://www.lebans.com/richtext.htm
 
Mitch,

You might also try something similar to http://www.lebans.com/mixbold-plain.htm
- it would be a pretty ugly hack though. In Lebans' example, he
modifies the "boldness" of text before printing it. You could possibly
use the Line function to underline your text like so:

1. Break your string into tokens and place in an array. Underlined and
non-underlined tokens alternate throughout the array. Consider writing
your own Split() function to take care of both characters {} at the
same time (I have one if you would like it).
2. Modifying Lebans' example, print the first token.
Record the X offset.
Print the next token.
Draw a line from the recorded offset to the .CurrentX using the
baseline of your text.
Repeat.

-Kris
 
Back
Top