Code Error - There is more than one item with this name...

Why am I getting this error?

I’m not sure about the relevance of that particular error message, but shouldn’t line 60 be something like the following:

vWO_Name = vWO_Name.ReplaceAll(Chr(34), "X")

I hope that helps.

I had stared and stared at the line… and totally missed that…
to the point when I tried to recreate the situation, I actually typed it in correctly :slight_smile:

Line 60 - ReplaceAll is NOT an in place replacement as Scott noted
Given a string and a replacement it produces a new string and you’re not assigning it to anything

Scott, thanks for pointing out my blind spot. For some reason I thought the variable was updating itself. I even had a blind-spot looking at the example on the doc help.

I’m still not off the hook. The quotes didn’t get replaced - see image…

What’s going on?

Note: the arrow shows the code pointer location.

are you sure they are CHR(34) quotes or “smart quotes”

chr(34) may not be the right character
its possible those quote are smart quotes and they are a different character (often &u2018/&u2019 or &u201c/ &u201d which are the left & right pairs for single & double “smart quotes”)

yeah… what we said :slight_smile:

I think you guys are on to something. But how do I use that in my code? What’s the ascii character equivalent or is there another method to do the substitution?

Maybe you can check the contents of vMO_Name (what you put in a square on your image) and see the hex representation?

Norman mentioned above the common Unicode values for those types of quotes

here is a topic to consider

https://forum.xojo.com/42491-how-to-replace-smart-quote-to-plain-quote-using-regex/0

unfortunatly… there is no RegEx solution,. just a series of REPLACEALL… but its something

Like this:

then

here the chr value is 34 (hex 22), your value should be different.

What if you put a break-point at the beginning of your While loop, and step through each iteration of your RecordSet - and drill down into each record (click on the RecordSet link in the debugger, bottom-right area of your screen-shot) to see the actual content returned from your query (before manipulating the vWO_Name string).

Does it show the contents of your WO_Name column any differently?

Yes I did do that. It is the same.

Alberto,

My value is different but I don’t know how to read the hex values.

unless I miscounted the leading value is CHRB(&h93) and the trailing one is CHRB(&H94)

[quote=443146:@Peter Greulich]Alberto,

My value is different but I don’t know how to read the hex values.

[/quote]
You have hex 93 and 94 (left double quote and right double quote), those are not standard double quotes. You need to replace chr (147) and chr(148)

Here are some references that may help in the future.

ASCII Character Table
ANSI Character Table

The hex 93 & 94 characters are found in the ANSI Table.