Link to home
Start Free TrialLog in
Avatar of Silas2
Silas2

asked on

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"
Avatar of Martin Liss
Martin Liss
Flag of United States of America image

You could do

 If Val(first string) = Val(second string) Then
SOLUTION
Avatar of Martin Liss
Martin Liss
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Silas2
Silas2

ASKER

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 Replace(<SomeVar1>,Chr(34),"") = Replace (<SomeVar2>, Chr(34),"") then
 'whatever
Else
'whateverelse
Endif
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.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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.