Changing attributes selectively

G

Guest

Many thanks to Duane Hookum on his assistance with my randomization question..

I have an interesting dilemma facing me now that concerns changing attributes in text boxes. Specifically, I'd like to be able to change the font weight of certain portions of text within the textbox. I am not sure if this is possible, but I thought I'd give it a shot. Details below

Currently I have a form that contains a very simple filter. The user enters information into a textbox, then clicks a command button. The command button initiates a filter on the form that searches through several memo and text fields in my table for occurrences of the word. The SQL statement reads as follows

strNewSearch = "([Question] Like '*" & strFilter & "*' OR [Case Text] Like '*" & strFilter & "*' OR [Choice A] Like '*" & strFilter & "*' OR [Choice B] Like '*" & strFilter & "*' OR [Choice C] Like '*" & strFilter & "*' OR [Choice D] Like '*" & strFilter & "*' OR [Choice E] Like '*" & strFilter & "*')

.... Where strFilter is the user-defined value in the textbox. I have a report ("rptKeyword") linked to this form that displays the results. What I would like to do, if it is possible, is bold each occurrence of the user-entered word or phrase on the report. Any advice or assistance is greatly appreciated. Thank you

Joe
 
M

Michael J. Strickland

I think you can only do that with a Rich Text Box (under "More Controls" in
the Toolbox).

For example, the following code will bold characters 3-4 of the string

rtfText.Text = "abcdefghijkl"
rtfText.SelStart = 3
rtfText.SelLength = 2
rtfText.SelBold = True


--
---------------------------------------------------------------
Michael J. Strickland
Quality Services (e-mail address removed)
703-560-7380
---------------------------------------------------------------
Joe said:
Many thanks to Duane Hookum on his assistance with my randomization question...

I have an interesting dilemma facing me now that concerns changing
attributes in text boxes. Specifically, I'd like to be able to change the
font weight of certain portions of text within the textbox. I am not sure
if this is possible, but I thought I'd give it a shot. Details below:
Currently I have a form that contains a very simple filter. The user
enters information into a textbox, then clicks a command button. The
command button initiates a filter on the form that searches through several
memo and text fields in my table for occurrences of the word. The SQL
statement reads as follows:
strNewSearch = "([Question] Like '*" & strFilter & "*' OR [Case Text] Like
'*" & strFilter & "*' OR [Choice A] Like '*" & strFilter & "*' OR [Choice B]
Like '*" & strFilter & "*' OR [Choice C] Like '*" & strFilter & "*' OR
[Choice D] Like '*" & strFilter & "*' OR [Choice E] Like '*" & strFilter &
"*')"
... Where strFilter is the user-defined value in the textbox. I have a
report ("rptKeyword") linked to this form that displays the results. What I
would like to do, if it is possible, is bold each occurrence of the
user-entered word or phrase on the report. Any advice or assistance is
greatly appreciated. Thank you,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top