Results 1 to 7 of 7
  1. #1
    gg80 is offline Competent Performer
    Windows 7 Access 2007
    Join Date
    Jul 2010
    Posts
    328

    Import CSV file problem

    I am trying to import a CSV file and I run into two problems.



    One-Using the import wizard, I choose "import to create a new table" and then check off delimited, no primary key etc. When I click finish, I get a message "--would not succeed because would create duplicate values in the index, primary key, or relationships." How is this possible? The table has not even been created yet.

    Two: I f I try to import it into an Access table with same column head names and all table fields set to text format, I get the "index or primary key cannot contain a null value" message.

    Using A2007 with W7. Any help much much appreciated.

  2. #2
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows XP Access 2003
    Join Date
    Aug 2013
    Posts
    7,862
    It has been a while since I ran the wizard but... Since it is a new table why not let Access create a Primary Key for you? If I recall correctly, it will build an autonumber column for you separate from the data being imported.

  3. #3
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Can you provide a CSV file that demonstrates the problem? I've never seen that error message.

  4. #4
    gg80 is offline Competent Performer
    Windows 7 Access 2007
    Join Date
    Jul 2010
    Posts
    328

    attached csv vile

    OYC_T009481331.zip

    I think that I have attached it. If not, let me know and I will try again. This procedure seems not as clear as it once was.

  5. #5
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    The CSV file is not in the correct format. When I tried to do the import in Access, the import routine saw 16 fields after the field "JS03"; these fields were actually data.

    The line separator is displayed as a box when viewed in Notepad. If I open the CSV file in Excel or Wordpad, then save it back out as CSV, the new field can be imported with no errors. (I did change some of the field types that Access selected to Text).

    So the CSV file format has formatting errors. I think the newline char is a tab char.... but this is just a guess.
    See attached CSV file that I saved using Excel to see the differences (Open using Notepad.)

    Try importing the attached file....

  6. #6
    gg80 is offline Competent Performer
    Windows 7 Access 2007
    Join Date
    Jul 2010
    Posts
    328
    I tried your file and the Wizard imported with no problems.

    The source who sets his site up for downloading his CSV file does his design with an Apple computer, which maybe source of problem. I have imported in past with an older version of my Access program with no problems, but it has been a while.

    I really appreciate your quick response and the fact that you have given me a definition of the problem This has been very frustrating. Thank you again . FYI, I will let you know what I learn from source of the csv file.

  7. #7
    gg80 is offline Competent Performer
    Windows 7 Access 2007
    Join Date
    Jul 2010
    Posts
    328
    The CSV creator modified the file and uploads ok now. I attached FYI. I'm still not clear why the old format worked fine with older versions of my program. Thanks again for help.


    OYC_T007869653Newer2.zip

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. Trying to import a CSV file
    By itm in forum Access
    Replies: 1
    Last Post: 04-13-2012, 06:00 PM
  3. Import XML file
    By randolphoralph in forum Programming
    Replies: 1
    Last Post: 01-22-2010, 09:12 PM
  4. Import prn file
    By Accessshelp@work in forum Import/Export Data
    Replies: 1
    Last Post: 10-29-2009, 09:16 AM
  5. CSV File Import
    By compasst in forum Import/Export Data
    Replies: 3
    Last Post: 03-31-2006, 09:37 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