windowsms-accesschr

Chr (169) not giving copyright symbol


I have an mdb split FE and BE which on my Windows 10 / Office 365 Acess is giving © for Chr(169).

On my client's machine (recent update to Windows 10) with Office 2013, Access is giving � (Actually, in the Immediate window it looks a 1 with an umlaut, then an upside down question mark then a superscript 1/2) for Chr(169).

In the Immediate window on the client's machine, Asc("©") gives 176 instead of 169.

It seems the character maps are different between the two machines, although when I go to the Character Map app, for Arial and Times New Roman it shows © as being 169.

How do I get the client's machine to match mine?

The first thing I was recommended to do was an Office Repair. After this, in the Immediate window I get a different value each time I do

?asc("©")

48 then 16 then 72 then 112 then 144 and so on, random numbers.

This is the same whether I copy a copyright symbol from MS Word or Character Map App.

Actually, when I paste the copyright symbol into the Immedate Window, it comes through as A(with circumflex over it)©. Does that help/mean anything?

Also the £ sign has an empty square next to it.

Anyone got any ideas? Office issue? Windows issue?

Thanks!


Solution

  • Always use AscW when using non-ASCII characters.

    A copyright sign is not part of standard ASCII, so may or may not be represented in the codepage Windows uses, depending on locale settings.

    AscW uses unicode instead of the Windows codepage, which means it will reliably produce the same result.

    Also, never store non-ASCII characters in VBA. If you need a specific character, you can look up the codepoint and use ChrW to generate the string. For multiple characters, I recommend you look at this answer, or store them outside of VBA.

    Then, as for the immediate window, that also does not support unicode characters, so you can't trust what gets displayed there. Nor does MsgBox. This makes debugging a pain. Look at this answer for having a messagebox with unicode support.