instr

G

Guest

Thanks for taking the time to read my question.

I have a field in a table that holds many values as a string

for example

lola br bgn ddt mmn lol

I want to use instr to find "lol". The problem is that it finds "lola" How
can I make this work so that it only finds "lol"? Each value in the string
is separated by a space.

I could step through each value in the string with a loop, but wondering if
there is a better way.

Thanks,

Brad
 
M

Marshall Barton

Brad said:
I have a field in a table that holds many values as a string

for example

lola br bgn ddt mmn lol

I want to use instr to find "lol". The problem is that it finds "lola" How
can I make this work so that it only finds "lol"? Each value in the string
is separated by a space.


Concatenate a space to each ens of botl the field and the
thing you're trying to find:

InStr(" " & thefield & " ", " " & somevalue & " ")
 
G

Guest

That is so briliant, I'm laughing out loud!!! I was trying to use the Split
function, but found out that it was introduced in 2000... unfortunately I'm
working in 97.

Thanks Marshall. Now maybe I'll be able to go home... it is Friday after all.

Have a great weekend,

Brad
 

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