Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Extract info from Memo field

Status
Not open for further replies.

debbieg

Technical User
Dec 2, 2002
190
US
I have inherited a database. One of the tables has a Memo field with what looks like a field within a field. Within the Memo field is text between <EXAMPLE1> and </EXAMPLE1>, and <EXAMPLE2> and </EXAMPLE2>.

I've been asked to create a report and the I need

* the text before <EXAMPLE1> to appear in a separate place
* the text between <EXAMPLE1> and </EXAMPLE1> to appear in a separate place
* the text between <EXAMPLE2> and </EXAMPLE2> to appear in a separate place

I have no idea what these items are in the <> or how to use them.

Please help! I'm on a deadline!
Debbie
 
Does your memo column contain XML data?

Anyway, if you need to do this in access queries, look at the Left, Right, Mid, and Instr functions in access' help files. If you have any specific questions with using any of these functions post back.

Here's a start:

Code:
left(MemoColumn, Instr(MemoColumn, '<example1>') - 1)

That will give you the left-most text.

Hope this helps,

Alex

Ignorance of certain subjects is a great part of wisdom
 
An alternative is Split:

[tt]astrMemo=Split(Memo1,"<")[/tt]

This will give you an array:

[tt]For i=0 To Ubound(astrMemo)
Debug.Print astrMemo(i)
Next[/tt]
 
The Split function worked great! Here's what I did:

LTemp = Replace(LDesc, "</QMTABLE>", "")
LTemp = Replace(LTemp, "</QMSTDFEAT>", "")
LTemp = Replace(LTemp, "<QMSTDFEAT>", "<QMTABLE>")

Dim tempstring() As String
tempstring = Split(LTemp, "<QMTABLE>", -1, vbTextCompare)
Model = tempstring(0)
SPEC = tempstring(1)
STDFEAT = tempstring(2)

Me.LDesc_Model = Model
Me.LDesc_Spec = SPEC
Me.LDesc_STDFEAT = STDFEAT

Thanks a bunch!
Debbie
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top