Results 1 to 8 of 8
  1. #1
    buckychudd is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Nov 2011
    Posts
    4

    Importing data with leading zeros

    Hi,



    We recently upgraded from Access 2003 to 2010. I have a table that I overwrite each month with new data from a tab delimited text file. There is a field in the table that I have formatted the data type as text. In the previous version of Access I could import the data and it would keep any leading zeros during the import. Now it is dropping the leading zeros when I import the data even though I have specifically formatted the data as text.

    Does anyone know how I can import my data and keep the leading zeros?

    Thanks!

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,622
    What method are you using for the import? The wizard or VBA? Show code. You might have to run an UPDATE query to fix the data.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    buckychudd is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Nov 2011
    Posts
    4
    Quote Originally Posted by June7 View Post
    What method are you using for the import? The wizard or VBA? Show code. You might have to run an UPDATE query to fix the data.
    I'm using the wizard.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,622
    So if the wizard won't import the leading zeros even if data is going to a text field and this is specified in the setup, then only suggestion I have is to run an UPDATE query on the field. Use Format function.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    buckychudd is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Nov 2011
    Posts
    4
    Quote Originally Posted by June7 View Post
    So if the wizard won't import the leading zeros even if data is going to a text field and this is specified in the setup, then only suggestion I have is to run an UPDATE query on the field. Use Format function.
    That kind of sucks, it worked correctly in 2003.

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,622
    I tested import of CSV and TXT files with 2007 and 2010. Both brought the data in with the leading zeros intact. Sorry, cannot replicate your issue. Do you want to provide the file and I will test it as well.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  7. #7
    buckychudd is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Nov 2011
    Posts
    4
    The weird thing is if I import to a new table it works fine. If I do an append import into my existing file it doesn't work. I can import into a new table then append that table into my existing file, but it worked much better before as a one step process where now it is a two step process.

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,622
    I tried the APPEND, still can replicate your issue.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Leading Zeros in Access 2010
    By aa_weber in forum Access
    Replies: 3
    Last Post: 10-16-2011, 11:17 PM
  2. Leading Zeros
    By dirtbiker1824 in forum Access
    Replies: 1
    Last Post: 03-14-2011, 02:16 PM
  3. Adding Leading Zeros
    By jo15765 in forum Access
    Replies: 13
    Last Post: 11-20-2010, 11:11 PM
  4. Replies: 6
    Last Post: 04-30-2010, 01:57 PM
  5. leading 'Zeros' in data
    By wasim_sono in forum Forms
    Replies: 3
    Last Post: 04-06-2009, 11:57 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums