How can I do help in InStr in MS Access?

How to make InStr case sensitive in MS Access?

I would like the following to be displayed 0

 msgbox InStr("In Here", "here")

Instead, I get 4.

I tried adding vbBinaryCompare

 msgbox InStr("In Here", "here", vbBinaryCompare)

but he complains about the type mismatch.

+5
source share
2 answers

This is not clear in the help section, but if you use an optional comparison argument, you also need to specify an optional initial argument to avoid a complaint about type mismatch.

So this maps 0 to MsgBox:

MsgBox InStr(1,"In Here", "here", vbBinaryCompare)
+7
source

Use InStrBinstead InStr. Then it will do a byte comparison by bytes, not a case insensitive case.

 msgbox InStrB("In Here", "here")

Displays 0.

+7
source

All Articles