G
Guest
I want to pad the field with leading zeros so it is 8 characters in length.
If the user enters 123, I want it to default to 00000123.
If the user enters 123, I want it to default to 00000123.
aceman62 said:I want to pad the field with leading zeros so it is 8 characters in
length. If the user enters 123, I want it to default to 00000123.
Tom said:if you want the column to
sort correctly, you would need to change the data. I would use
Right("0000000" & CurrentValue, 8)
To finish the job properly:
Make the column fixed width 8 characters i.e. CHAR(8) rather than
VARCHAR(8).
Use a validation rule to disallow non-numeric characters
my_col LIKE '[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
Jamie Collins said:Tom said:if you want the column to
sort correctly, you would need to change the data. I would use
Right("0000000" & CurrentValue, 8)
To finish the job properly:
Make the column fixed width 8 characters i.e. CHAR(8) rather than
VARCHAR(8).
Use a validation rule to disallow non-numeric characters (make it
implementation-independent, i.e. handle both 'ANSI mode' and other
mode, by avoiding wildcard characters):
my_col LIKE '[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
Jamie.
You would rather the developer store eight characters...
instead of storing a four byte Long
Dang! You don't much like Access users and developers, do you? ;-)
You would rather the developer store eight characters (or 16 if
Unicode compression is avoided), and create a validation rule to ensure that
only digits are stored in the column, instead of storing a four byte Long
that needs no such Validation Rule or leading zeros?
All this so that the
developer doesn't have to write a simple formatting function that displays
the digits with leading zeros?
You would rather the users type in all eight digits, including the leading
zeros?
I must have the buggy version of Access
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.