• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Removing HTML within Access Database

So we import information and it's filled with HTML tags, and I want to find a way to easily replace it with the Expression Builder.

The PlainText function doesn't work very well as the <br> <p> tags etc. create new lines within the new field, and leaves some of them blank.

The best way would probably be to create a replace function like:

Replace(field, "<*>","")

Where all fields that start with < and end with > are removed. How would I do this though?
 
This is the most obvious solution, but you have to put a replace function for every possible html opening and closing tag, which is not very fun.

UPDATE table SET Field1 = Replace(Replace(Field1, '<p>', ''), '<br>', '')

So your other better choice is to use a User Defined Function.
This guy wrote some VBA code to strip out the HTML tags from a string:
http://www.helium.com/items/251916-how-to-create-a-vb-function-to-remove-html-code-from-a-string

Use this guys function in your Access Solution and call it from SQL like:

UPDATE table SET Field1 = PrepareForMetaTag(Field1)
 
Can you use a wildcard within Access queries? That's what I was going for with the <*>. I'm new to Access so I've never used a User Defined Function so I'll give that a try..
 
Back
Top