contents.gifindex.gifprev1.gifnext1.gif

InStr

Purpose

Returns the position of the first occurrence of one string within another string.

Arguments

SYNTAX 1

Instr( [start,]strexpr1 , strexpr2 )

SYNTAX 2

Instr( [start,]strexpr1 , strexpr2, compare )

The Instr function uses these arguments:

start
Numeric expression that sets the starting position for each search; start must be between 1 and approximately 65,535. If start is omitted, the search of strexpr1 begins at the first character position. The start argument is not optional if the compare argument is specified.
strexpr1
String expression being searched.
strexpr2
String expression being sought.
compare
Specifies the string-comparison method. The argument compare must be 0, 1, 2, or the value of the CollatingOrder property of a field object or a Database object, and start must also be specified.
Notes

If strexpr2 is found within strexpr1, InStr returns the position at which the match was found. If strexpr2 is zero-length, start is returned. If start is greater than strexpr2, strexpr1 is zero-length, or strexpr2 cannot be found, InStr returns 0. If either string expression is Null, the function returns a Null. If start or compare is Null, an error occurs.