changing a number to text

  • Thread starter Thread starter pat67
  • Start date Start date
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
 
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
 
Back
Top