How to Remove HTML Div Tags from Microsoft Access Text Fields
Question details
The user needs to remove HTML tags from database records so the data displays as plain text instead of formatted markup.

- Product
- Microsoft Access
- Device & OS
- not provided
- Scenario
- Cleaning up a database table where text fields have inadvertently saved values with HTML formatting.
- Observed behavior
- Short Text fields display HTML markup, such as <div>SURNAME</div>, instead of showing just the plain text data.
Before running any update queries, create a secure backup copy of your database table to ensure you do not accidentally overwrite or lose important data during testing.
Use an Update Query with the PlainText Function
The most effective way to clean the data permanently is by transferring it to a new field using the PlainText() function within an Access update query.
Microsoft Access provides the PlainText function specifically for converting Rich Text (HTML) strings back into unformatted text. Creating a new column to store the cleaned data minimizes the risk of accidental data loss.
Open your database table in Design View and rename the affected field (e.g., from Surname to SurnameOld).
Add a new Short Text field to the same table and name it with your original field name (e.g., Surname).
Navigate to the Create tab on the ribbon, click Query Design, close the table dialog, and switch to SQL View.
Paste the expression: UPDATE YourTableName SET Surname = PlainText([SurnameOld]) WHERE SurnameOld Is Not Null; (replacing YourTableName with your actual table name), and click Run.

Use the PlainText Function as a Temporary Workaround
If you cannot alter the table structure immediately, you can strip the tags dynamically when displaying or combining the data.
Looking for a Free, Lightweight Office Suite?
While Microsoft Access requires a paid subscription to manage databases, WPS Office provides a free, highly compatible suite for your daily document, spreadsheet, and presentation needs. It seamlessly handles Microsoft Office formats like DOCX, XLSX, and PPTX with zero learning curve.
- 1. Visit the WPS Website: Go to the official WPS Office website to find the correct installer for your operating system.
- 2. Download the Software: Click the 'Free Download' button to safely download the lightweight installation package.
- 3. Install and Work: Run the installer, open the application, and start creating or editing your Microsoft Office compatible files instantly.

Frequently Asked Questions
Why is Microsoft Access saving plain text with HTML tags?
This usually happens if the field's 'Text Format' property was at one point set to 'Rich Text'. Access saves Rich Text data as HTML markup behind the scenes. Simply changing the property back to 'Plain Text' in Design View does not always automatically strip the existing HTML tags from previously saved records.
Does the PlainText() function remove all HTML tags?
Yes, the PlainText() function is specifically designed to interpret Microsoft Access Rich Text (HTML) and return only the unformatted text content, stripping out layout and formatting tags like <div>, <strong>, and <em>.
Can I apply the PlainText function directly to the existing field without renaming?
Modifying a field directly in an update query (e.g., UPDATE Table SET FieldA = PlainText(FieldA)) is possible but highly discouraged. If an error occurs during the update process, the data might be truncated or corrupted. It is much safer to pull the cleaned data into a newly created field.
How do I prevent HTML tags from being stored in the future?
Ensure that the 'Text Format' property of your Short Text or Long Text fields in the Table Design view is explicitly set to 'Plain Text'. You should also check the properties of any corresponding text boxes in your data entry Forms to ensure they are not configured to accept Rich Text.




