changing a number to text

P

pat67

What i have is 10 what i need to see is 00010. Or if it is 150 I need
to see 00150. In other words I need to add zeros to the front of the
number to create a length or 5 characters. In Excel i just do
text(cell,"00000"). In Acess i tried using Plain Text function, but i
still get 10 or 150 when I use PlainText([Field],5) where 5 is the
length. Any ideas?

Thanks
 
J

John W. Vinson

What i have is 10 what i need to see is 00010. Or if it is 150 I need
to see 00150. In other words I need to add zeros to the front of the
number to create a length or 5 characters. In Excel i just do
text(cell,"00000"). In Acess i tried using Plain Text function, but i
still get 10 or 150 when I use PlainText([Field],5) where 5 is the
length. Any ideas?

Thanks

A Number has no leading zeros - in a Number field, 10 and 00010 and
00000000000010 are exactly the same value.

If you need to convert a Number field to a Text field with leading zeros, you
can use the Format() function, which accepts a number and returns a string:

Format([number], "00000")

will cast the value in the field [number] into a five-character string with
leading zeros.
--

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