Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

if fld.name "is like" futurefield

Status
Not open for further replies.

charanch

Programmer
Jan 3, 2004
55
US
Hello to this great forum. I'm new here so please bear with me. I know about =, >, <, and <> but is there an operator for &quot;like&quot; in an IF statement, as there is in a SQL statement? Here's what I need:

I'm using:

for each fld in oRs.fields
if fld.name &quot;is like&quot; &quot;Futurefield&quot; then
'do something
end if
next

If that's not possible, what if anything can I do weed out the futurefields? Thank you very much for your thoughts!

 
use the instr function:

for each fld in oRs.fields
if instr(fld.name,&quot;Futurefield&quot;) then
'do something
end if
next
 
First: the InStr function returns the numeric position of the first occurrence of a specified substring within a specified string when starting from the beginning (left end) of the string. So it does not return true or false, but an integer.

Second: i suppose you want to check if the contents of the field contains &quot;Futurefield&quot;. In the sample above the test is on the fieldname.

So change it to:

for each fld in oRs.fields
if instr( fld.value,&quot;Futurefield&quot;) > 0 then
'do something
end if
next

br
Gerard
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top