Zero fill numeric field

A

Annette

I have a field that is numeric field that has a 5 in it. I need to
export it to a file, but the file export it to requires that the
numeric field be zero filled. How can I export my 5 to 00005 and still
have it a numeric field? Likewise if I have a field with a 0 in it how
can I export my 0 to be zero filled and still be a numeric field so I
end up with 00000?
 
J

John W. Vinson

I have a field that is numeric field that has a 5 in it. I need to
export it to a file, but the file export it to requires that the
numeric field be zero filled. How can I export my 5 to 00005 and still
have it a numeric field? Likewise if I have a field with a 0 in it how
can I export my 0 to be zero filled and still be a numeric field so I
end up with 00000?

Use a calculated field in a Query and export the Query (rather than the
table):

ExpNumberfield: Format([numberfield], "00000")

will convert the Number to a String with five digits, with leading zeros. If
you want to export a NULL value as 00000 use

Format(NZ([numberfield], 0), "00000")
--

John W. Vinson [MVP]
Microsoft's replacements for these newsgroups:
http://social.msdn.microsoft.com/Forums/en-US/accessdev/
http://social.answers.microsoft.com/Forums/en-US/addbuz/
and see also http://www.utteraccess.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top