Results 1 to 2 of 2
  1. #1
    New Lounger
    Join Date
    Feb 2003
    Thanked 0 Times in 0 Posts

    Importing Leading Zeros From a Text File (Access 97)

    Hi folks - new to the forum so of course, I'll open with a question. I tried a search first before posting so as not be redundant.

    I'm importing a .txt file into a table using a saved Spec. The first field (set to be a text field in Access), 7 spaces has numbers with leading zeros. Access is dropping the zeros. I can format the field so it displays the leading zeros with '0000000' but zeros aren't really there. When I try to export the file to a .txt file, the zeros get dropped again.

    Any help on this?

    TIA - MIke.

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Sacramento, California, USA
    Thanked 1 Time in 1 Post

    Re: Importing Leading Zeros From a Text File (Access 97)

    The simplest way to deal with this is to create a table to import the data into. Make that field a text field and make sure your spec is importing text and not a number into that field. The import wizard sometimes thinks it knows best and will take the first value for a field as the appropriate datatype, even though that isn't what you want. However, if you set up a table to receive the import, you can force the data into the desired datatype. You should make sure, though, that those leading zeroes really are in the text file you're importing. You may also need to format the field in the query you export rather than just exporting from the table if you want to be sure to include leading zeroes going the other way.

Posting Permissions

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