From: tted78 on
I need a way to test a particular text field in a table for the presence of a
particular word. I have tried "If (field1 contains "test")" without success.
Is there a means to do this in vba for Access 2007? Thank you
From: JackPoland on
F1 -> InStr(Pos, StrToSearch, SearchingText)

"tted78" wrote:

> I need a way to test a particular text field in a table for the presence of a
> particular word. I have tried "If (field1 contains "test")" without success.
> Is there a means to do this in vba for Access 2007? Thank you
From: kc-mass on
Try this:

Use the Instr() function (Check the help file for details)

SELECT InStr([Field1],"Text") AS DataFound
FROM tblData
WHERE (((InStr([Field1],"Text"))>0));

That will check for the existence of "Text" within Field1.


Regards

Kevin



"tted78" <tted78(a)discussions.microsoft.com> wrote in message
news:49916C6D-5CEE-44A7-AFBE-DE800263D59A(a)microsoft.com...
>I need a way to test a particular text field in a table for the presence of
>a
> particular word. I have tried "If (field1 contains "test")" without
> success.
> Is there a means to do this in vba for Access 2007? Thank you


From: John Spencer on
You can also use a like operator.

IF Field1 LIKE "*TEXT*" THEN
'Do something

I would probably use Instr function unless I needed to use wildcard characters
in the match.

John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County

kc-mass wrote:
> Try this:
>
> Use the Instr() function (Check the help file for details)
>
> SELECT InStr([Field1],"Text") AS DataFound
> FROM tblData
> WHERE (((InStr([Field1],"Text"))>0));
>
> That will check for the existence of "Text" within Field1.
>
>
> Regards
>
> Kevin
>
>
>
> "tted78" <tted78(a)discussions.microsoft.com> wrote in message
> news:49916C6D-5CEE-44A7-AFBE-DE800263D59A(a)microsoft.com...
>> I need a way to test a particular text field in a table for the presence of
>> a
>> particular word. I have tried "If (field1 contains "test")" without
>> success.
>> Is there a means to do this in vba for Access 2007? Thank you
>
>
 | 
Pages: 1
Prev: a
Next: Access 2003 data Issue