Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can I programmatically code the Code Page in my program

Status
Not open for further replies.

smsmail

Programmer
Aug 11, 2010
105
US
Hello,

When my program executes, and access an external file, my program prompts for the CODE PAGE.

Can I programmatically code the code page for the external file in my program?

Thank you in advance!
 
The easiest solution is to issue this command near the start of your program:

SET CPDIALOG OFF

This will prevent the dialogue from appearing. (I'm assuming you don't want to manually set the code page when you first open the table in VFP.)

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro tips, advice, training, consultancy
Custom software for your business
 
If you talk about a dbf as the external file, Mike is right. And it would also be good not to change the code page of the dbf as that might corrupt data for whatever other app may be using the same dbf.

That problem can occur if you for example use a dbf of a dos app in windows.

You can set the code page your program will work with via a config.fpw with the line CODEPAGE=...., eg 437 for US MSDOS or 850 for international MS DOS.

Besides that the codepage dialog only pops up, if you open the dbf exclusive and it has no codepage set. So that indicates you have one or two errors: The dbf has no codepage set and you work exclusive on it. The latter is an error only, if the app should support shared data access. Exclusive acccess but can be okay for single user or maintainance, when you want or need exclusive access.

See cpzero (maybe that was used on the dbfs) and use it to set the correct codepage on the dbfs.

Bye, Olaf.
 
Thank you Mike and Olaf.

Your help is very much appreciated.

Ave'

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top