views:

65

answers:

3

I have an access database in which the field type is text and it contains 26 numbers. I converted it to excel, but it has only the first 5 numbers

Text in database: 91234612345678912345678912
Text in excel :   9.12346E+25

How to get the entire field from database to excel?

A: 

Unless you explicitly specify the format of the excel cell to be "Text" it will be treated as a number by excel.

When converting the database value make sure to set the "Cell Formatting" to "Text", alternatively if you can paste some sample code then may be someone can refine it and help.

HTH

Anand
+1  A: 

If you are performing the export yourself, you could prefix the field with an apostrophe (') to force Excel to treat the field as text rather than a number. Unfortunately, this has the side-effect of not allowing mathematical operations to be performed on the field, as it is no longer a number. It also puts that annoying green triangle in the upper-left of the cell warning you that you have converted a number to text.

Jason Z
A: 

can't you export it as it is, and then highlight the column and change the type to text? Won't that convert it to the right value?

sql_mommy
Actually, in this case it won't work because the original field, when interpreted as a number, has too many digits for Excel's numeric format to handle (you can get at best 15 significant digits).
John Y
ah. thanks for the clarification.
sql_mommy