Holding the zeros

  • Thread starter Thread starter gvaughn
  • Start date Start date
G

gvaughn

I have a table made in sql that I need the value to hold the zeros in fron of
the number. For example I have a number 0035, I need it to show the zeros
instead of changing the number to just 35? Any solutions?
 
"0035" is text, not number. Just like US zip codes look like numbers but
they aren't (you don't "do math" on them).

What is stored and how it is displayed can be two different matters, though.

If you need all four characters "0035" so you can compare one record to
another, use a text/character data type.

If you want "0035" for appearance sake, use Format() or other functions to
zero-pad your "number".

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
Either change the field to a text field so that the leading zeroes will
be saved or use the format property of controls or the format function
in a query to show leading zeroes. Number fields will NOT save leading
or trailing zeroes.

Format(SomeField,"0000")

"... table made in sql ..." Does this mean you have a table in MS SQL
Server or do you mean you used a make table query to create a table or
do you mean something else?


'====================================================
John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
'====================================================
 
Can one do this in excel? I have a similar problem, but need a .csv file to
hold its zeros.
 
I don't know. Ask in one of the Excel forums.

John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
 
Back
Top