Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

What's up with A2000 Strings?

Status
Not open for further replies.

JimHorton

Programmer
Jan 29, 2000
991
US
I've seen alot of bizzare behaviour in Access 2000, and I rarely use it, but in one project I noticed that direct string comparisons are, well, goofy.&nbsp;&nbsp;Example:<br><br>(Option Compare Database)<br><br>Dim str1 as string, str2 as string<br>str1 = &quot;Microsoft&quot;<br>str2 = &quot;Can't Spell&quot;<br>If str1 = str2 Then<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;msgbox &quot;It Figures&quot;<br>Else<br>&nbsp;&nbsp;&nbsp;&nbsp;msgbox &quot;No Problem&quot;<br>End If<br><br>I always get &quot;It Figures&quot;<br>I'm aware of string comparison functions, but&nbsp;&nbsp;why can't this equality comparison be made?&nbsp;&nbsp;Was there a FAQ on 2000 that I missed explaining this new behaviour? (it works in '97)<br>Thanks,<br>--Jim
 
Jim, I just entered your code into a new module:<br><br>Sub TryStringCompare()<br><br>Dim str1 As String, str2 As String<br>str1 = &quot;Microsoft&quot;<br>str2 = &quot;Can't Spell&quot;<br>If str1 = str2 Then<br>&nbsp;&nbsp;&nbsp;MsgBox &quot;It Figures&quot;<br>Else<br>&nbsp;&nbsp;&nbsp;MsgBox &quot;No Problem&quot;<br>End If<br><br>End Sub<br><br>I get &quot;No Problem&quot;.
 
elizabeth,<br>It must be due to some Reference of some other component on my machine--my home machine does that (the wrong way) even in the debug window: <br>?&quot;Hello&quot; = &quot;World&quot;<br>True<br><br>At work, it doesn't happen, it's fine.&nbsp;&nbsp;Strange.&nbsp;&nbsp;Tonight I'll dig deeper. <br>--Jim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top