View Full Version : Leading Zeros


JEB
01-16-2007, 07:07 AM
I am exporting a report from Access into Excel. One field has a store # - say 029. I need to have the leading zero in the field - but I can not get Excel to leave it there.

Any suggestions?

Thanks for the help.

Jeb

mhartman
01-16-2007, 07:43 AM
You need to make sure that the column in Excel that this item goes in is formatted as "Text"

Regards
Mark

JEB
01-16-2007, 08:01 AM
Thanks for the reply.

The problem is that I would like it to export directly from Acess into Excel- without opening an Excel worksheet and formatting the cells.

Is there a way to have Excel recognize numbers as text when being exported?

Thanks,
Jeb

boblarson
01-16-2007, 08:13 AM
Just format your field in your query to export like this:
Num: Format(CStr([Number]),"000")
changing Num to whatever you want your column header to be
and [Number] to whatever your number field name is called.

mhartman
01-16-2007, 09:45 AM
Hello:

I tried Bobs solution and could not get it to work when I ran the query and exported it.

YourNewColumn: "000" & [YourNumberField]

in a query does work though

Regards
Mark

boblarson
01-16-2007, 11:02 AM
worked fine for me.

JEB
01-16-2007, 12:07 PM
Didn't work for me. I am trying to export from an Acess REPORT - not just from the query. I don't know if that makes any difference

Thanks,
Jeb