[AccessD] Highlighting Select Words in a Large Text Field

Brad Marks BradM at blackforestltd.com
Sun Sep 30 14:35:58 CDT 2012


Shamil,

Because the field is coming from a database in a purchased package, I cannot control how the data is stored.

If I used a TextBox control with the property set to "Rich Text", I am not sure how I could change the text to highlight the selected word(s).  Maybe there is a way to do this, but I could not find an example.

Thanks,
Brad    

-----Original Message-----
From: accessd-bounces at databaseadvisors.com on behalf of Salakhetdinov Shamil
Sent: Sun 9/30/2012 2:28 PM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Highlighting Select Words in a Large Text Field
 
Hi Brad --

Why not use (unbound) TextBox control with its Text Format property set to "Rich Text"?

Thank you.

-- Shamil


Sun, 30 Sep 2012 13:40:06 -0500 ?? "Brad Marks" <BradM at blackforestltd.com>:
>	
>
>
	
	
>
		
		
			
>All,
>
>
Ever since I became a member of the AccessD forum a couple years ago, I have asked many questions and received a ton of great ideas and solutions.  I am grateful for this help.  However, as a relative newcomer, I have not been able to contribute very much that others might find useful.  I share the following example with the idea that others may benefit from some work that I did over the weekend.
>
>
The small firm where I work has a purchased manufacturing system.  I have built an inquiry system using Access 2007 with ODBC access to the manufacturing system database. This works very nicely.  Recently, our users requested a new inquiry that would allow them to search for records that contain select words that are found in a large text field.
>
>
This was easy to accomplish with a little VBA code that changes the SQL based on the word or words that the users specify.  This works fine, except that the resulting data on an Access report is simply displayed as one big chuck (over 1,000 bytes).  I needed to find a way to highlight select words. 
>
>
In the purchased manufacturing system database, the field in question is defined as a memo field.  I did some research to see if it was possible to highlight select words when displaying a memo field, but could not find a quick solution.
>
>
Here is what I came up with over the weekend.
>
>
I use VBA code to change the SQL based on the string that the users request.  The select records are available via a Record Set. 
>
>
I then wrote a little VBA code that adds HTML tags as needed to create an HTML file and to highlight the requested words in bold red.
>
>
When all of the records in the Record Set are processed, the VBA code initiates Internet Explorer to display the generated HTML file.
>
>
This approach did not take a lot of time to build and it seems to work nicely.
>
>
I showed what I had built to my wife and she did not seem to be impressed.  I showed it to one of our three children and he was not impressed either.  I showed it to the family dog and he also was not impressed.  I am starting to feel like the Rodney Dangerfield of the database realm.  I plan to show the final results to the users tomorrow (Monday).
>
>
Anyway, I thought that I would share this concept and perhaps someone else would benefit. 
>
 
>
Brad
>
>
			
>-- 
>
AccessD mailing list
>AccessD at databaseadvisors.com
>http://databaseadvisors.com/mailman/listinfo/accessd
>
Website: http://www.databaseadvisors.com
>
>
		
		
	

	
-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.




More information about the AccessD mailing list