Link to home
Start Free TrialLog in
Avatar of Drjdh
DrjdhFlag for United States of America

asked on

Trimming characters

I have a 2010 Microsoft Access database which has the following code that parses a text field:  

"TROPONIN-I/CTNI                                   <0.03    ng/mL"

s = Split(LabPaste, "TROPONIN-I/CTNI  ")
If UBound(s) > 0 Then
strLab = Split(Trim(s(1)), " ")(0)
strLab2 = Split(Trim(s(1)), " ")(1)
If (strLab = "<" Or strLab = ">") Then
Text863 = strLab
Text657 = strLab2
Else
Text863 = ""
Text657 = strLab
End If
Else
End If

Open in new window


The problem is that I get an error because there is no space between the "<" and the "0.03".  I need to trim off the "<" somehow and return only "0.03"

Any help would be greatly appreciated!
Avatar of Lee W, MVP
Lee W, MVP
Flag of United States of America image

I'm not sure where or why you're getting that error, but you can use Replace -

Replace(StringOrField, "<", "")

You're replaceing "<" with "" (empty/nothing)
Avatar of Drjdh

ASKER

I actually want to keep the "<" and place that in a field.  In the above code, if "<" is present, then it is stored in control Text863.
ASKER CERTIFIED SOLUTION
Avatar of Drjdh
Drjdh
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Drjdh

ASKER

This "InStr" function was the key to this one.