if statement using LIKE ??

if statement using LIKE ??

am 01.10.2005 02:41:42 von SusieQ

I have a field in an Access2000 DB that I would like to query using
LIKE

<%IF(RecordSet.Fields("fieldname") LIKE %PA% )Then%>

This throws error messages all over the place, mostly Sub or Function
not defined

Can anyone tell me how to do this correctly??
TIA

Re: if statement using LIKE ??

am 01.10.2005 04:11:51 von McKirahan

"SusieQ" wrote in message
news:OM9KLDixFHA.788@tk2msftngp13.phx.gbl...
>
>
>
> I have a field in an Access2000 DB that I would like to query using
> LIKE
>
> <%IF(RecordSet.Fields("fieldname") LIKE %PA% )Then%>
>
> This throws error messages all over the place, mostly Sub or
Function
> not defined
>
> Can anyone tell me how to do this correctly??
> TIA

LIKE is used in SQL statements not IF statements.

Perhaps you want the InStr() function:

<% If InStr(RecordSet.Fields("fieldname"),"PA") > 0 Then %>

Re: if statement using LIKE ??

am 01.10.2005 07:57:49 von SusieQ

That's exactly what I was looking for
thanks so much


"McKirahan" wrote in message
news:TLudndaVteL2baDeRVn-sg@comcast.com...
> "SusieQ" wrote in message
> news:OM9KLDixFHA.788@tk2msftngp13.phx.gbl...
>>
>>
>>
>> I have a field in an Access2000 DB that I would like to query using
>> LIKE
>>
>> <%IF(RecordSet.Fields("fieldname") LIKE %PA% )Then%>
>>
>> This throws error messages all over the place, mostly Sub or
> Function
>> not defined
>>
>> Can anyone tell me how to do this correctly??
>> TIA
>
> LIKE is used in SQL statements not IF statements.
>
> Perhaps you want the InStr() function:
>
> <% If InStr(RecordSet.Fields("fieldname"),"PA") > 0 Then %>
>
>