VBA double quote escaping question

How do you compare two strings when one is
3"
and the other is "3"""
which is the same 3 inches but with the double quote within the string escaped.
I want to do a straight "is string equal"
Silas2Asked:
Who is Participating?
 
DatabaseMX (Joe Anderson - Microsoft Access MVP)Connect With a Mentor Database ArchitectCommented:
If only it were a perfect world :-)
0
 
Martin LissOlder than dirtCommented:
You could do

 If Val(first string) = Val(second string) Then
0
 
Martin LissConnect With a Mentor Older than dirtCommented:
Or in a formula, something like

=IF(SUBSTITUTE(A1,CHAR(34),"")=SUBSTITUTE(B1,CHAR(34),""),"Equal","Not equal")
0
The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

 
Silas2Author Commented:
I was thinking along those lines, and stripping all the quotes out, but that's a bit crude and wouldn't catch quite a few possibilities, (although I have to think quite hard to come up with any but in large(ish) volumes there might be some)
0
 
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database ArchitectCommented:
If Replace(<SomeVar1>,Chr(34),"") = Replace (<SomeVar2>, Chr(34),"") then
 'whatever
Else
'whateverelse
Endif
0
 
Martin LissOlder than dirtCommented:
I was thinking along those lines, and stripping all the quotes out, but that's a bit crude and wouldn't catch quite a few possibilities, (although I have to think quite hard to come up with any but in large(ish) volumes there might be some)
If you think of a possibility, let me know.
0
 
PatHartmanConnect With a Mentor Commented:
That's just one of the many problems that mushing multiple attributes into a single field causes.  Use one field for just the number and the second for the unit of measure.  EVERY field should be atomic.  That's what first normal form specifies.
0
 
PatHartmanCommented:
I can't tell you how many of these situations I have fixed over the years.  It's almost always better to simply resolve the data problem by splitting the mushed field once.  Then everything else just works better.  Of course if you have no control over the table schema you're SOL.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.