Append characters to field data

razorking

Registered User.
Local time
Today, 15:38
Joined
Aug 27, 2004
Messages
332
I know this can be done, but I cannot remember how, hoping someone can save me some time:

I have a field with values like this:
5
22
123
1234


I want to append zeros to the front of the field data using a query so the value in the field will always be five charactere long and will be padded withing eading zeros, like this:
00005
00022
00123
01234

Sorry for the easy question, will appreciate any help.

Thanks!
 
The problem there is that I do need the leading zeros to be part of the data, if I format the field that way that is just a display property.

The Format property affects only how data is displayed. It doesn't affect how data is stored
 
Last edited:
So do you need an input mask for future inputs or a means to convert existing data?
 
What I really want to do is convert existing data. It is one of those strange reasons that I hate to try and explain (the why part) just trust me, I need to get leading zeros appended to the field data for all numbers so the field value is always five characters and is proceeded by zeros. I was hoping to do this in query and just leave the source table as is, but I can live with anything that gets me what I have described above. Thanks!
 
UPDATE YourTable SET YourTable.YourField = Format([YourField],"00000");
 
right now the field data is numeric, I think I can make it text with no problems.
 
razorking said:
right now the field data is numeric, I think I can make it text with no problems.
.
.
.

Bingo. :)
 

Users who are viewing this thread

Back
Top Bottom