Parsing a Text Field in Access 2007

  • Hello,

    I am trying to parse a dynamic text field that looks like this "HR=62 bpm, NIBP=109/60 mmhg, SpO2=96.0 %, Resp=45 B/min". The part i want is the '109' part although it wont always be 3 digits it could also be 2.

    I have come up with the following that strips out everything but is still leaving the /x or /xx depending on the number of digits before the '/'.

    Trim(Mid([Note],InStr(1,[Note],"P=")+2,InStr(InStr(1,[Note]," ")+1,[Note]," ")-InStr(1,[Note]," ")))

    I have tried using the / as a limiter and played with the length but i get an error or nothing at all.

    Thanks in advance!

    E

  • chriej1 (4/20/2011)


    ... I am trying to parse a dynamic text field that looks like this "HR=62 bpm, NIBP=109/60 mmhg, SpO2=96.0 %, Resp=45 B/min". The part i want is the '109' part although it wont always be 3 digits it could also be 2. ...

    I would use an IsNumeric() check on the third character after the "NIBP=" to see if it was the "/" character or the third digit and concatenate it when the numeric test is true. That would involve using a second Mid() function to get the the third character and then test it, and an IIF() function to either concatenate the number, or a null when it is not numeric.

    Wendell
    Colorful Colorado
    You can't see the view if you don't climb the mountain!

  • Thanks, I will give it a try.

    E

  • Try this:

    Val(Right([Note], Len([Note]) - InStr(1, [Note], "NIBP=") - 4))

    returns the answer as a number.

  • WILLIAM MITCHELL (4/22/2011)


    Try this:

    Val(Right([Note], Len([Note]) - InStr(1, [Note], "NIBP=") - 4))

    returns the answer as a number.

    This worked great.

    Thanks

    E

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply