Leading zero's

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am importing values from a text file in access into text fields. Some of
these are numeric values. I need to add leading zero's to these values to pad
them out as the software requires the values to nine digits in front of the
decimal place and two after. The nine digits also will contain the negative
sign if the value is negative. At the moment I am having to import the file
into access and manualy update the format.

Thank you for any help pointing me in the right direction.
 
Numbers aren't stored with or without leading zeros. To a computer, 0001 is
the same as 1.

The easiest way to maintain leading zeros is to store the values as text
fields, not numeric fields. This is doubly true if you're never going to do
arithmetic with the numbers (think Zip Codes or SSNs)
 
You should look up in the help file "format function"

If you already have your minus sign in the text field
after importing then look up left, mid, right functions
 
If it is something like a certificate number which always hasd the same
number of digits and is stored as text data, I write an update query that
readys the length of the data in the field. Then I use the replace function
to add a leading 0 to the data I already have. I then run the update query
the number of times equal to the length of the field.
 
That sounds query intensive (IE slow).
You might want to look into the format funtion.

Question to mark,
"I need to add leading zero's to these values to pad
them out as the software requires the values to nine digits in front of
the
decimal place and two after."
What is "the software" and how are you getting the data fromaccess to
"the software"?
If you are outputting another file use you can create a query with the
format function to get the data in it's proper format. It doesn't have
to be stored with leading 0s then. Also I am not sure if you could
make a spec for the export wizard to fill in leading zeros.
 
Back
Top