Get Unicode Text From Access DB in VB

Posted on 2004-11-14
Medium Priority
Last Modified: 2012-05-05

I'm using a database I created in MS Access XP. From a VB 6.0 application I connect to my databse using
MS Jet 4.0 engine. My database contains tables with text fields that contain unicode characters.
When I try to get these records from the database all the unicode characters are replaced with '?'s

I already checked the controls in VB and they can display unicode characters. The problem is that I get
the text from the database already messed up.

Who can I get this text right? Do I need to change the engine I use to connect to the database?
Do I need to configure the fields in my DB differently?

Tanks in advance,
Nisim Aytek.
Question by:aytek_nisi

Expert Comment

ID: 12581741
This is a test comment
LVL 58

Accepted Solution

harfang earned 500 total points
ID: 12583370
First, we should make sure whether you get unicode from Access or not.
Using a DAO or ADODB recordset, retrieve a string for which you know there is an extenden character at position n. Extract that to a string variable. Example:

    Dim strTest as String
    strTest = Mid(recTable.Fields(2).Value, 5)

This would store a string starting with the fifth character of the third field into the variable. I can guarantee that the Field object does return a unicode enabled string (i.e. an array of integers, not bytes). Now observe this in the immediate pane:

    ? AscW(strTest)

If you get 63, this is no longer Unicode. If it is higher than 255, the problem is not with the JetEngine or the database. If you *do* get 63, it might be worthwile to write unicode into the table, for example ChrW(916) should be the greek upper-case delta (a triangle). Write that into a field, and read it back. If you can do that, it means that the data was flattened to 8-bit before entering the table...

As for enabling Unicode data in a VB control, you should ask in the VB channel. The only advice here would be to build a unicode string (using ChrW(913) & ChrW(914) & ... for a greek alphabet) and to assign that to an unbound control. If that shows, Unicode can be displayed.

Good Luck!

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question