Extract content from HTML string associated with a particular element.

Posted on 2012-09-19
Last Modified: 2012-09-20
I need a function to extract the value in this string that is associated with the Display Text element.   I want to use this code in an Access query.
In this example the function returns "Joe Green"

<PickerEntities><PickerEntity><Description>Match found</Description><DisplayText>Joe Green</DisplayText><IsResolved>true</IsResolved><Key>Green, Joe</Key><EntityData><EntityDataItem><Key>Last Name</Key><Value>Green</Value></EntityDataItem><Entity
Question by:StevenPMoffat
    LVL 35

    Accepted Solution

    something like this?

    Open in new window

    LVL 35

    Expert Comment

    by:Robert Schutt
    Here's how it looks.
    captureHope you were looking for something like that.

    Author Comment

    This almost works.   It does in the case that I have presented to you, but in a similar case it doesn't work.    What does the 13 represent?  

    Here is the other example that doesn't work.
    <PickerEntities><PickerEntity><Description>Match found</Description><DisplayText>Paul Juneau</DisplayText><IsResolved>true</IsResolved><Key>Juneau, Paul</Key><EntityData><EntityDataItem><Key>Last Name</Key><Value>Juneau</Value></EntityDataItem><EntityData

    Author Closing Comment

    Ignore my previous concern.  My mistake.
    LVL 35

    Expert Comment

    by:Robert Schutt
    Ignore the whole post? Just in case you still wanted to know the first part: 13 is the length of the first search text "<DisplayText>".

    EDIT: you may need a check if it is ever possible that the search text doesn't occur in the string.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
    A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
    Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
    In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now