Solved

Trimming characters

Posted on 2013-06-19
4
303 Views
Last Modified: 2013-06-25
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!
0
Comment
Question by:Drjdh
  • 3
4 Comments
 
LVL 95

Expert Comment

by:Lee W, MVP
Comment Utility
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)
0
 

Author Comment

by:Drjdh
Comment Utility
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.
0
 

Accepted Solution

by:
Drjdh earned 0 total points
Comment Utility
Here is the solution for those of you interested:

s = Split(LabPaste, "TROPONIN-I/CTNI  ")
If UBound(s) > 0 Then
strLab = Split(Trim(s(1)), " ")(0)
strLab2 = Split(Trim(s(1)), " ")(1)
Text901 = Trim(s(1))
Text902 = strLab
Text903 = IIf(InStr(strLab, "<") > 0, "<", IIf(InStr(strLab, ">") > 0, ">", ""))
Text904 = IIf(InStr(strLab, "<") > 0, Val(Mid(LabPaste, InStr(LabPaste, "<") + 1)), IIf(InStr(strLab, ">") > 0, Val(Mid(LabPaste, InStr(LabPaste, ">") + 1)), strLab))

Open in new window

0
 

Author Closing Comment

by:Drjdh
Comment Utility
This "InStr" function was the key to this one.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
Today's users almost expect this to happen in all search boxes. After all, if their favourite search engine juggles with tens of thousand keywords while they type, and suggests matching phrases on the fly, why shouldn't they expect the same from you…
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…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

743 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