Parsing text value

G

Guest

I have a field that contains 2 separate appended values separated by a " - ".
That's a "space-space"

The data to the left and right of the - can be any length and contain any
number of characters.

I'm trying to parse this so I can retreive the data to the left and to the
right. The " - " will always be there.

Can anyone help me with this?
 
G

Guest

Use the InStr() function in combination with the Left(), Right() or Mid()
functions.
Let's say your string field name is strText.

LeftAnswerString = Mid(strText, 1, Instr(1, strText, " - "))
RightAnswerString = Mid(strText, Instr(1, strText, " - ") + 3)


jmonty
 
C

Charles E. Vopicka

check out the split function


split(MyField,"-")(0)

and

split(MyField,"-")(1)


for left and right of the -. if you don't specify the array position
you will have a string array returned. i couldn't live with out the
split function.

I have a field that contains 2 separate appended values separated by a " - ".
That's a "space-space"

The data to the left and right of the - can be any length and contain any
number of characters.

I'm trying to parse this so I can retreive the data to the left and to the
right. The " - " will always be there.

Can anyone help me with this?


--
Charles E. Vopicka's (Chuck) : (e-mail address removed)

Database Management, GIS Specialist and Research Assistant

Forest Biometrics Research Institute
University of Montana - College of Forestry and Conservation
Missoula, MT 59812
United States of America

Phone:
(406)243-4526
(406)243-4264
(406)549-0647 (Home)

:) HAVE A NICE DAY (-:

"UNLESS" (The Lorax, by Dr. Seuss)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top