Returns a Variant (Long) specifying the position of the first occurrence of one string within another.
InStr([start, ]string1, string2[, compare])
The InStr function syntax has these arguments:
Optional. Numeric expression that sets the starting position for each search. If omitted, search begins at the first character position. If start contains Null, an error occurs. The start argument is required if compare is specified.
Required. String expression being searched.
Required. String expression sought.
Optional. Specifies the type of string comparison. If compare is Null, an error occurs. If compare is omitted, the Option Compare setting determines the type of comparison. Specify a valid LCID (LocaleID) to use locale-specific rules in the comparison.
The compare argument settings are:
Performs a comparison using the setting of the Option Compare statement.
Performs a binary comparison.
Performs a textual comparison.
Microsoft Access only. Performs a comparison based on information in your database.
string1 is zero-length
string1 is Null
string2 is zero-length
string2 is Null
string2 is not found
string2 is found within string1
Position at which match is found
start > string2
The InStrB function is used with byte data contained in a string. Instead of returning the character position of the first occurrence of one string within another, InStrB returns the byte position.