See if field contains a string

  • Thread starter Thread starter Sean G.
  • Start date Start date
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
 
Simplest would be:
If [MyField] Like "*box*" Then

You can also use Instr() to search for the location of the substring.
 
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.


.
 
Back
Top