Foreign characters in linked text file

G

Guest

How does one refer to foreign characters in VBA? I am aware of
www.lookuptables.com and can see the characters in their various forms, but
how do I reference an extended ascii code in vba, with the intent to replace
it with an english character?

Thanks,
Melanie
 
G

Guest

use the ASC function. Each character has an ascii numeric value. If you are
doing a find/replace procedure, then naturally, you must know beforehand what
you are searching for and what you want to replace it with. That said, use
the website you mentioned to determine the ascii code for each foreign
character you expect your data to contain and, say you want to replace à,
which has an ascii code of 244, write code like:

If Asc(SomeFieldOrOtherValue) = 244 Then
SomeFieldOrOtherValue = "a"
Endif

Hope that helps
 
G

Guest

Jon,

Thanks for the prompt and informational answer. One more thing... Can you
help me alter my existing function to account for this foreign character: Æ?
(146 in ascii.) My function is
IIf([Description] Is Not Null,Replace([Description],<something to identify
Æ>,"AE"),"").

Description is a text field, variable length.

Thanks for the help,
Melanie
 
D

Douglas J Steele

IIf(IsNull([Description]), "", Replace([Description],Chr$(146), "AE"))


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Melanie O said:
Jon,

Thanks for the prompt and informational answer. One more thing... Can you
help me alter my existing function to account for this foreign character: Æ?
(146 in ascii.) My function is
IIf([Description] Is Not Null,Replace([Description],<something to identify
Æ>,"AE"),"").

Description is a text field, variable length.

Thanks for the help,
Melanie

JonWayn said:
use the ASC function. Each character has an ascii numeric value. If you are
doing a find/replace procedure, then naturally, you must know beforehand what
you are searching for and what you want to replace it with. That said, use
the website you mentioned to determine the ascii code for each foreign
character you expect your data to contain and, say you want to replace à,
which has an ascii code of 244, write code like:

If Asc(SomeFieldOrOtherValue) = 244 Then
SomeFieldOrOtherValue = "a"
Endif

Hope that helps
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top