See if field contains a string

S

Sean G.

Hello,

In code I would like to see if a field contains the
string "box" anywhere in the field. I tried Like and I
couldn't get that to work. Thanks.

-Sean
 
A

Allen Browne

Simplest would be:
If [MyField] Like "*box*" Then

You can also use Instr() to search for the location of the substring.
 
S

Sean G.

Thank you very much, both your suggestions worked great!

-----Original Message-----
Simplest would be:
If [MyField] Like "*box*" Then

You can also use Instr() to search for the location of the substring.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

In code I would like to see if a field contains the
string "box" anywhere in the field. I tried Like and I
couldn't get that to work. Thanks.


.
 

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