Help!

Gunit

Registered User.
Local time
Today, 17:11
Joined
Aug 29, 2004
Messages
32
Need some help!!! I have a sequence of numbers in a column/table that I need to add ending zeros too. Field length needs to be = 6 bytes total

23 - add 0000
4265 - add 00

etc. I'm thinking a customized expression is the answer but I'm not completely comfortable writing scripts in a module yet. :( Any help would be appreciated! :o
 
You could do something like this:

MyField = MyField & Left("000000", 6 - Len(MyField))


If you want to permanently update these figures in your table you could also use a form of this expression in an update query such as:

Update To: [MyField] & Left("000000", 6 - Len([MyField]))

Be aware that if any of the numbers are more than 6 digits the expression will result in an error.
 
Last edited:
Wow. That was very simple actually. It worked perfectly! Thanks so much Richo!
 
The update query appeared to give me the results I wanted. It actually added ending zeros to the original numeric value in table. Should this have been done another way?
 
I was under the impression that you wanted to add "trailing" zeros to the numbers, as opposed to leading zeros.

Did you want 23 to be 230000 or 000023?

If you wanted 000023 you would just have to reverse 2 parts of the expression:

Update To: Left("000000", 6 - Len([MyField])) & [MyField]
 

Users who are viewing this thread

Back
Top Bottom