Extract part of field contents from memo field

S

SF

Hi,

I have a memo field that store formatted text (included <div>), I want to
extract the text only excluding the formmated character like <div>, <font>
etc...).

Is there a way to acheive that?

Regards

SF
 
M

MGFoster

SF said:
Hi,

I have a memo field that store formatted text (included <div>), I want to
extract the text only excluding the formmated character like <div>, <font>
etc...).

Is there a way to acheive that?

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Use Replace() (Access Version 2000 and greater) to remove the strings
you don't want:

Replace(memo_field, "<div>", "")

Replaces all strings of "<div>" with and empty string "". Repeat for
each string you want to delete. You can also nest the Replace:

Replace(Replace(memo_field, "div",""),"font","")

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)
** Respond only to this newsgroup. I DO NOT respond to emails **

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBSd6k+YechKqOuFEgEQKYogCfZo4PNHWRlW3WnnAs9WFsECSlMTYAnRF4
scJlEPvuF+zWYwNd+AU15bnH
=Z49o
-----END PGP SIGNATURE-----
 
K

Ken Sheridan

The following function will remove any number of substrings passed into the
function as a parameter array:

Public Function RemoveStrings(strFullString As String, _
ParamArray aRemoveList() As Variant) As String

Dim varString As Variant

RemoveStrings = strFullString

For Each varString In aRemoveList
RemoveStrings = Replace(RemoveStrings, varString, "")
Next varString

End Function

e.g. RemoveStrings("<div>abcd<font>efgh","<div>", "<font>") returns abcdefgh.

Paste the function into a standard module and in a query enter the following
in the 'field' row of blank column in query design view:

MyPurgedmemoField: RemoveStrings([MyMemoField], "<div>", "<font>")

adding any other substrings you want removed to the list.

Ken Sheridan
Stafford, England
 

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