Results 1 to 4 of 4
  1. #1
    Join Date
    Jul 2007
    Posts
    6

    Unanswered: padding with leading zeros

    I have an Access query, that I need to export as a fixed length file. I need some fields to be padded with leading zeros to export the file with the correct fields at the correct length.

    How can I pad these integer fields with leading zeros? Please help!

  2. #2
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    Format(FieldName, "00000")

    Where the number of zeros is the total desired length.
    Paul

  3. #3
    Join Date
    Jul 2004
    Location
    South Dakota
    Posts
    267
    You could also use the String function. You pass the number of times to repeat the character and the character to repeat and concatenate that to your field. Like yourField = String(5, "0") & Field1.

    Just remember that yourField will now be a string type.

    C

  4. #4
    Join Date
    Jul 2007
    Posts
    6
    Quote Originally Posted by pbaldy
    Format(FieldName, "00000")

    Where the number of zeros is the total desired length.

    Thanks...I used a verion of this!

Posting Permissions

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