Stripping Charcter's from a record

T

Tom Olsen

All,

I have to strip away all HTML tags that will appear in a record.
Basically, I have to write something that would delete anything between <
and > including the sign. So all the <bold> and <Body> and the rest of the
tags have to be deleted,
Access 2003.

Thanks in advance..

Tom
 
D

Devlin

This should get you started...

Write a simple search and replace function using instr() and left() and
right()

You can use this function in an update query to remove all tags.

Here's how...

Function MyFunction(MyString As String) As String
Dim lPos As Long
Dim lEndPos As Long
Dim sLeft As String
Dim sRight As String
Dim sReturn As String

sReturn = MyString

Do
lPos = InStr(1, sReturn, "<")
If (lPos > 0) Then
lEndPos = InStr(lPos, sReturn, ">")
If (lEndPos > 0) Then
sLeft = Left(sReturn, lPos - 1)
sRight = Right(sReturn, Len(sReturn) - lEndPos)
sReturn = sLeft & sRight
End If
End If
Loop While lPos > 0

MyFunction = sReturn

End Function


Good Luck!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top