Page 1 of 2 12 LastLast
Results 1 to 15 of 17
  1. #1
    pacoako is offline Novice
    Windows XP Access 2007
    Join Date
    Aug 2014
    Posts
    8

    Cool Import CSV file - Field with numbers containing thousand space seperator

    Hi guys,

    I was wondering if there was anyway to import a file containing numbers with a "thousand space separator"

    example :

    1 000


    2 000
    3 000
    4 000 000
    5 000 000 000

    Only workaround I found so far is to import de numbers into a text field in a temp table, do an update query to remove the spaces and then transfert the data into the real table that has a numeric field

    Thanks in advance for your help,

  2. #2
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    Often times I will import CSV files to a temp table where each column is of data type Text. Then I use VBA for data validation as I move the records over to their permanent home.

  3. #3
    pacoako is offline Novice
    Windows XP Access 2007
    Join Date
    Aug 2014
    Posts
    8
    Quote Originally Posted by ItsMe View Post
    Often times I will import CSV files to a temp table where each column is of data type Text. Then I use VBA for data validation as I move the records over to their permanent home.
    Thanks for your answer ItsMe.

    It's actualy what I do for now... I was just wondering is there was an easier way of doing this. Like an importation parameter I didn't think about...

  4. #4
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    If the entire portion of data to be imported is guaranteed to be structured and formatted correctly, you can avoid the data verification/validation and import directly into a table with your proffered data types. Otherwise, the only other way I am aware of is to parse the file and do data validation in your parse procedure (open file via automation and read every line).

  5. #5
    pacoako is offline Novice
    Windows XP Access 2007
    Join Date
    Aug 2014
    Posts
    8
    Thats very interesting! How do u turn it off?

  6. #6
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    Quote Originally Posted by pacoako View Post
    ... How do u turn it off?
    Turn what off?

  7. #7
    pacoako is offline Novice
    Windows XP Access 2007
    Join Date
    Aug 2014
    Posts
    8
    Data vérification

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,967
    The data verification referenced by ItsMe is VBA code. I don't think you will be able to avoid VBA with that CSV structure.
    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.

  9. #9
    pacoako is offline Novice
    Windows XP Access 2007
    Join Date
    Aug 2014
    Posts
    8
    HI June. Thanks for ur reply.
    Perhaps it would be interesting to investigate that path as well... Maybe i could. Automate something in vba... Do u have any piece of code i could start with?
    Thanks 4 ur help

  10. #10
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,967
    VBA must open the CSV file as an object, read each line of the file, parse the string into an array, loop the array and do something with each element. In your case, will have to concatenate the number parts.

    Bind: Access VBA line input CSV

    http://programmersheaven.com/discuss...te-to-csv-file
    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.

  11. #11
    pacoako is offline Novice
    Windows XP Access 2007
    Join Date
    Aug 2014
    Posts
    8
    I will look foward to that tomorow. Do u know if this will be faster than importing in a temp table, update and transfer in final table?

  12. #12
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,967
    Probably not and the code is certainly more complicated.

    And I revise my earlier comment. With the temp table process you currently use, can avoid VBA.
    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.

  13. #13
    pacoako is offline Novice
    Windows XP Access 2007
    Join Date
    Aug 2014
    Posts
    8
    Quote Originally Posted by June7 View Post
    Probably not and the code is certainly more complicated.

    And I revise my earlier comment. With the temp table process you currently use, can avoid VBA.
    Alright June. I think i'll try to automate the process throught the temp table instead

    Thanks a lot for your time!

    See ya

  14. #14
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Try this on a COPY of the CSV file

    You might also try opening the CSV file using notepad.
    EDIT/REPLACE
    In Find what, press the space key
    In Replace with, press the comma

    Click on the Replace All button.
    Save the CSV file.

  15. #15
    pacoako is offline Novice
    Windows XP Access 2007
    Join Date
    Aug 2014
    Posts
    8
    Quote Originally Posted by ssanfu View Post
    Try this on a COPY of the CSV file

    You might also try opening the CSV file using notepad.
    EDIT/REPLACE
    In Find what, press the space key
    In Replace with, press the comma

    Click on the Replace All button.
    Save the CSV file.
    Hi Ssanfu,

    thanks for your post

    The thing is that the files are pretty huge... approx 1million records. Doing search and replace via notepad is very slow unfortunatly

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Import Excel file based on a date and time in file name
    By nhylan in forum Import/Export Data
    Replies: 4
    Last Post: 04-16-2013, 03:26 PM
  2. Import Errors - Fields with Numbers and Letters
    By Eekers in forum Import/Export Data
    Replies: 5
    Last Post: 01-10-2012, 02:52 PM
  3. Replies: 1
    Last Post: 11-29-2011, 08:43 AM
  4. Decimal seperator between different languages
    By seshan in forum Programming
    Replies: 3
    Last Post: 01-31-2010, 03:03 PM
  5. Replies: 3
    Last Post: 01-15-2010, 02:28 PM

Tags for this Thread

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