Results 1 to 5 of 5
  1. #1
    sesling is offline Novice
    Windows XP Access 2003
    Join Date
    Nov 2011
    Posts
    8

    Values in a memo field

    I have a table that contains a memo field. I would like to search the memo field and display values that exist between <recCnt> and </recCnt>. ex. ....<recCnt>37868368</recCnt)..... So in the example I want the query to return 37868368. The values will appear in different locations within the memo field. I pasted two sample entries from the memo field below.

    Entry 1 <payload><recCnt>37868368</recCnt><physicalFileName>/work/share/local/apps/samplefile1.ABC</physicalFileName></payload>

    Entry 2


    <payload><pfId>cd57e241-d165-4632-9eef-d21990ac61d4</pfId><recCnt>37868368</recCnt><physicalFileName>/work/share/local/apps/samplefile2.ABC</physicalFileName></payload>

  2. #2
    pdebaets is offline Competent Performer
    Windows Vista Access 2010 (version 14.0)
    Join Date
    Jul 2010
    Location
    Los Angeles
    Posts
    235
    You can use the xg_GetWordsBetween function to find text between two other strings. The xg_GetWordsBetween function is in our string functions module available for download here: http://peterssoftware.com/strfn.htm

    Ex.:

    dim strResult as string
    strResult = xg_GetWordsBetween(Forms!MyForm!MyMemoControlName, "<recCnt>","</recCnt>")

  3. #3
    sesling is offline Novice
    Windows XP Access 2003
    Join Date
    Nov 2011
    Posts
    8
    Thx for the info...However our company policy prohibits me from downloading the function. Would there be another way using the existing functions inside MS Access to get at the data?

  4. #4
    sesling is offline Novice
    Windows XP Access 2003
    Join Date
    Nov 2011
    Posts
    8
    I stumbled across a solution. Not sure its the best way but it worked.

    Mid([payload],((InStr([payload],"<recCnt>"))+8),(InStr([payload],"</recCnt>"))-(InStr([payload],"<recCnt>"))-8)

    payload = memo field name
    recCnt = first parameter I was looking for
    /recCnt = second parameter I was looking for

  5. #5
    pdebaets is offline Competent Performer
    Windows Vista Access 2010 (version 14.0)
    Join Date
    Jul 2010
    Location
    Los Angeles
    Posts
    235
    Here's the xg_GetWordsBetween function:

    Code:
    Function xg_GetWordsBetween(sMain As String, s1 As String, s2 As String) As String
    '* Returns a trimmed substring of the string 'sMain' that lies between substrings s1 and s2
    '* Ex.: xg_GetWordsBetween("The Lazy Fox", "The", "Fox") returns "Lazy".
    Dim Rtn As String
    Dim iStart As Integer
    Dim iEnd As Integer
    On Error Resume Next
    
    iStart = InStr(1, sMain, s1)
    If iStart = 0 Then
        Rtn = ""
    Else
        iStart = iStart + Len(s1)
        iEnd = InStr(iStart, sMain, s2)
        Rtn = Trim(Mid(sMain, iStart, iEnd - iStart))
    End If
    xg_GetWordsBetween = Rtn
    
    On Error GoTo 0
    End Function

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Memo Field
    By joekuhn in forum Access
    Replies: 2
    Last Post: 07-10-2011, 09:00 PM
  2. Memo Field
    By maintt in forum Forms
    Replies: 3
    Last Post: 08-24-2010, 07:39 AM
  3. Memo field ?
    By beast_b9 in forum Access
    Replies: 2
    Last Post: 05-26-2010, 08:09 AM
  4. append to memo field
    By stuart rose in forum Programming
    Replies: 1
    Last Post: 08-12-2009, 10:02 AM
  5. MEMO field
    By casporov in forum Access
    Replies: 1
    Last Post: 11-11-2006, 08:17 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums