Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Forums   Help   Contact   Merch   Join   Order   Logon  
 
Back to Access Forum    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
Access Rich Text Memo Field
Roland Roberts 
    
5 years ago
Is there a way to search an Access (2010) rich text memo field with VBA code to find if the HTML tag for the red color, or any other color, is being applied somewhere in that rich text memo field and if it is, then perform some VBA code?
Roland Roberts OP  @Reply  
    
5 years ago
Never mind.  Turns out the InStr code will find the HTML snippet.  You just have to be careful to limit the code being searched to someething in HTML that will not be split across lines in the field being searched or InStr will not find it since it also evaluates Newline characters.  Here is some sample code to do this search:

Private Sub subFindHtmlSnippet()

    Dim varFound As Variant, strString1 As String, strString2 As String
    
    strString2 = "color=red>"                           'What HTML snippet are you looking for?
    strString1 = Me![YourTextFieldWithRichText]         'Where are you searching for it?
    varFound = InStr(1, strString1, strString2)         'Do the search
    If varFound > 0 Then                                'Search successful
        'MsgBox "InStr returned: " & varFound           'For Testing
        ***Perform some code if found***                
    Else
        'MsgBox "InStr returned: " & varFound           'For Testing
        ***Perform some
Roland Roberts OP  @Reply  
    
5 years ago
Sorry, the else statement got cut off so here is the back of the Sub:

    Else
        'MsgBox "InStr returned: " & varFound           'For Testing
        ***Perform some code if NOT found***
    End If

End Sub
Richard Rost  @Reply  
          
5 years ago
Thanks for sharing.

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Access Forum.
 

Next Unseen

 
New Feature: Comment Live View
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2026 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 5/8/2026 7:44:46 AM. PLT: 0s