By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,395 Members | 2,541 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,395 IT Pros & Developers. It's quick & easy.

How to export text files using different character set than the machine locale is?

P: 1
Hi,

I am running MS Access 2003 on an XP machine. I have developed a database which have some of the tables fields in a language different than English (Eastern Europe one, Polish and others), i.e. an Unicode codepage is used as there're some specific non-English characters being used, for example in people's names.

Here comes the tricky part -- I have written a piece of VBA code to export some tables/queries into a flat text files which are to be used later on a website and read using Perl. Everything's fine on the machine which has the Polish localization set, so the export function works great producing flat text files with the codepage ISO-8852. But -- when switching to the UK based machine, when the codepage is different, what happens is just having a 'regular' equivalent of the diacritic character in English. For example, instead of having 'ę', it exports 'e'.

When I export the table using the Menu command (File|Export) and then choosing the Advanced Options and 'Central European (ISO)' as a Code Page, it does work for the text file.

Now, the quesion is: how can I do it from VBA level, when all I do is (some line of the code are removed for the clarity):

Expand|Select|Wrap|Line Numbers
  1. Set qdf = CurrentDb.QueryDefs(rsQuery)
  2. Set rst = qdf.OpenRecordset()
  3. Open rsFileName For Output As #riFile
  4. rec = rst.GetRows(1)
  5. rsTmp = rec(1, 0)
  6. Print #riFile, rsTmp
I know there's probably the work-around having the codepage changed somehow on the machine, but first I don't want to change it and second, I might not have had enough rights to do it as this is a corporate laptop.

Any ideas?

regards,
Grzegorz
Jun 24 '10 #1
Share this Question
Share on Google+
2 Replies


Expert 100+
P: 1,221

Oralloy
Expert 100+
P: 983
Another thing you might try is recording your manual export using a macro, then inspecting the resultant code and transferring the pertenent parts to your VBA code.
Jun 25 '10 #3

Post your reply

Sign in to post your reply or Sign up for a free account.