PRB: Zip-Code Format Changed If Imported from Microsoft Excel

ID: Q135116

The information in this article applies to:

SYMPTOMS

When importing a Microsoft Excel spreadsheet into FoxPro, you may see differences in the formatting of certain numbers. One example of this is when bringing over zip codes. A zip code may have a leading zero (0) in Microsoft Excel. The same zip code when imported into FoxPro will have a leading space. This is by design.

RESOLUTION

You can easily change this behavior. After the import is complete, if you see leading spaces where you want leading zeros. For example, assuming the field is named Zip and has a width of five, type the following command to update the table to show leading zeros instead of spaces:

   REPLACE ALL Zip WITH STRTRAN(Zip," ","0")

STATUS

This behavior is by design.

Additional reference words: FoxWin 2.50 2.50a 2.50b 2.60 2.60a KBCategory: kbinterop kbprb KBSubcategory: FxinteropExcel

Last Reviewed: August 21, 1995