InStr function Language Reference
Version 1
Please see
--------------------------------------------------------------------------------
Describe
Returns the position of the first occurrence of a string in another string.
Grammar
INSTR ([Start,]string1, string2[, compare])
The syntax for the INSTR function has the following parameters:
Parameter description
Start optional. A numeric expression that sets the starting position for each search. If omitted, the search begins at the position of the first character. If start contains Null, an error occurs. If you have specified compare, you must have the start argument.
String1 must be selected. The string expression that accepts the search.
string2 must be selected. The string expression to search for.
Compare optional. Indicates the numeric value of the comparison type to use when calculating the substring. For numeric values, see the "Settings" section. If omitted, a binary comparison is performed.
Set up
The Compare parameter can have the following values:
Constant numerical description
Vbbinarycompare 0 performs binary comparisons.
vbTextCompare 1 performs a text comparison.
Vbdatabasecompare 2 performs a comparison based on the information contained in the database (performing comparisons in this database).
return value
The INSTR function returns the following values:
If InStr returns
String1 is zero length 0
String1 is null null
String2 is zero-length start
STRING2 is null null
String2 didn't find 0.
Find the location of the matching string in the string1 string2
Start > Len (string2) 0
Description
--------------------------------------------------------------------------------
Note the InStrB function uses the byte data contained in the string, so InStrB returns not the character position where the string first appears in another string, but the byte position.
--------------------------------------------------------------------------------