Results 1 to 3 of 3
  1. #1
    5 Star Lounger
    Join Date
    Oct 2001
    Location
    San Bernardino, California, USA
    Posts
    734
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Another leading zero question (XP,2000)

    I have unsuccessfully tried to make an input mask. I have some fields that are 12 characters and I need to have leading zeros. For example, if I enter A31267 it should display as 000000A31267

    What is the best way to do this? The field in the table is TEXT and length is 12. Should I have the input mask defined at the table level or as part of the default value or where.... and, of course, how?

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Another leading zero question (XP,2000)

    I don't think you can do this with an input mask or a format. I wouldn't know how to provide leading zeroes in a text field that can contain alphabetic characters; it doesn't make much sense.

    You can create a calculated field in a query based on the table, or us a text box on a form or report with an expression that displays the data the way you want. In a query, it could be done like this:

    DisplayValue: Right("000000000000" & [FieldName],12)

    and as control source of a text box:

    =Right("000000000000" & [FieldName],12)

    The quoted string contains 12 zeros, and FieldName must be replaced by the name of your field.

  3. #3
    5 Star Lounger
    Join Date
    Oct 2001
    Location
    San Bernardino, California, USA
    Posts
    734
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Another leading zero question (XP,2000)

    Hmmm. Well, it is actually used to capture (manually input) barcodes from different items. The coding convention is 12 characters and is typically a Letter followed by some numbers. Maybe it would be best to simply input the actual code then add the leading zeros later through string manipulation.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •