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 
convert html to plain text
John Yeung 
     
3 years ago
i have got a field with html formating (something like <div> and <p>) embedded in a plain text.
how to write a query or vba to convert this to simple plain text field ?
Kevin Robertson  @Reply  
           
3 years ago
Use the PlainText function:

X: PlainText([MyField])
John Yeung OP  @Reply  
     
3 years ago
thanks Kevin, it works well

I did asked AI Claude this,  it just gave me the following suggestion , and it didnt work

"
Yes, there are a few ways to convert the HTML-formatted text to plain text within Microsoft Access:

Using a query:

- Create a query that selects the HTML text field
- Add an IIf() statement to remove HTML tags:

IIf(InStr([HTMLField],"<")>0,RemoveHTMLTags([HTMLField]),[HTMLField])

Where RemoveHTMLTags() is a VBA function to strip tags.

Using VBA:

- Write a VBA function to strip HTML tags
- Call the function and pass the HTML text field as a parameter
- Update the field with the return plain text value

Example VBA function:

Function StripHTMLTags(HTML As String)
  Dim RE As New RegExp
  RE.Pattern = "<[^>]*>"
  RE.Global = True
  StripHTMLTags = RE.Replace(HTML, "")
End Function

- Then in a module call:

UpdateTable Set PlainTextField = StripHTMLTags(HTMLField)

Use a macro/module:

- Create a macro that loops through records
- Calls the VBA strip function on each record
- Updates the plain text field

So in summary, the query method is easiest if you don't need VBA code. Otherwise write a reusable VBA stripping function and call it from a query, module, or form event as needed.

"

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: 4/30/2026 1:37:05 PM. PLT: 1s