Bug in INSTR function 
Author Message
 Bug in INSTR function

Has anyone encountered this INSTR anomaly in Access VBA?  It appears to be
in both Access97 and in Access2000.  The following code will find the upper
case M in the string "em".

Public Function Test() As Boolean

Dim x As String

x = "em"

If InStr(x, "M") > 0 Then
  MsgBox "M"
  Test=true
End If

End Function

--
Alexander Medwedew
http://www.*-*-*.com/



Tue, 23 Apr 2002 03:00:00 GMT  
 Bug in INSTR function
This is not a bug, this is a feature!

If nothing special is mentioned MS Access ignores the case, e.g.

InStr(1, "em", "M") = 2

but if you enforce a binary compare, e.g.

InStr(1, "em", "M", vbBinaryCompare) = 0

then you'll see the difference.

--
Greetings from Hamburg

Joerg Lueders



Quote:
> Has anyone encountered this INSTR anomaly in Access VBA?  It appears to be
> in both Access97 and in Access2000.  The following code will find the
upper
> case M in the string "em".

> Public Function Test() As Boolean

> Dim x As String

> x = "em"

> If InStr(x, "M") > 0 Then
>   MsgBox "M"
>   Test=true
> End If

> End Function

> --
> Alexander Medwedew
> http://visual-engineering.com/



Tue, 23 Apr 2002 03:00:00 GMT  
 Bug in INSTR function
Using the same code in Visual Basic 4.0-6.0 returns a different result.

--
Alexander Medwedew
http://visual-engineering.com/

Quote:

>This is not a bug, this is a feature!

>If nothing special is mentioned MS Access ignores the case, e.g.

>InStr(1, "em", "M") = 2

>but if you enforce a binary compare, e.g.

>InStr(1, "em", "M", vbBinaryCompare) = 0

>then you'll see the difference.

>--
>Greetings from Hamburg

>Joerg Lueders



Fri, 26 Apr 2002 03:00:00 GMT  
 Bug in INSTR function
I think you are mistaken here. Likely you are dealing with the
different defaults (database compare in Access, text compare in
VB).

--
MichKa

-------------------------------------
don't send questions by e-mail unless
you're paying for it. (TANSTAAFL!) :-)

random junk of dubious value, replica
error and problem fixing, and the
*TSI Form/Report to Data Access Page Wizard*, at:
http://www.trigeminal.com


Quote:
> Using the same code in Visual Basic 4.0-6.0 returns a different
result.

> --
> Alexander Medwedew
> http://visual-engineering.com/




Quote:
> >This is not a bug, this is a feature!

> >If nothing special is mentioned MS Access ignores the case,
e.g.

> >InStr(1, "em", "M") = 2

> >but if you enforce a binary compare, e.g.

> >InStr(1, "em", "M", vbBinaryCompare) = 0

> >then you'll see the difference.

> >--
> >Greetings from Hamburg

> >Joerg Lueders



Fri, 26 Apr 2002 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. InStr function bug?

2. Visual Basic InStr function bug??

3. Instr Bug?

4. InStr Function Help

5. Instr function

6. InStr Function does not work if start position is skipped

7. Instr Function Explanation Anyone ???

8. INSTR function flawed (QB45)

9. INSTR function NOT flawed (QB45)

10. Function InStr with VB 5 and Access 97

11. Proble with INSTR function in SQL statement

12. Using the Instr function

 

 
Powered by phpBB® Forum Software