Results 1 to 8 of 8
  1. #1
    dlaprade is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2012
    Posts
    4

    Index or Primary Key Cannot Contain a Null Value

    I'm trying to upload an Excel file into Access and I keep getting an error
    message. It says: "Index or primary key cannot contain a Null value." When I


    click "show help" directly below this error message, I am told:


    This error can be caused by one of the following:
    (1) The maximum number of columns allowed in a table or the maximum
    number of locks for a single file is exceeded.

    (2) The indexed property of a field is changed from Yes
    (Duplicates OK)
    to Yes (No Duplicates) when duplicate data exists in
    the table.

    (3) An expression is not specified in the Expression
    property of a calculated field.


    I've looked and there don't seem to be any non-numerical values in the
    column that I want to set as my primary key. Any idea what might be causing the
    problem? I've attached a copy of the file, for reference. (I want to set
    the "ORF Name" column as the primary key.) Thanks!


    Attached Files Attached Files

  2. #2
    John_G is offline VIP
    Windows XP Access 2003
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    There are no blank values in that field, so that's not the problem. Do you have an index on any of the other columns, with required = Yes? If so, you will get that error if there are any blank cells in the corresponding column of the Excel spreadsheet.

    John

  3. #3
    dlaprade is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2012
    Posts
    4
    @John_G

    Thanks! I just checked, and when it comes time to specify field options I select "No" for the "Indexed:" option for every column. But I still have the problem. Is there another way that an index might have been set? Any other ideas as to what might be going wrong?

  4. #4
    jzwp11 is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2010
    Location
    Dayton, OH
    Posts
    2,901
    You cannot use the ORF name as a primary key since it is not unique. These ORF Names occur more than once in your dataset

    ORF Name ID
    YCR088w 587
    YCR088W 586
    YJR155w 3001
    YJR155W 3000
    YLL006w 3314
    YLL006W 3313
    YPL166w 5264
    YPL166W 5263

  5. #5
    John_G is offline VIP
    Windows XP Access 2003
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    Hi -

    Are you importing into an existing table, or creating a new one? If you are importing to an existing one, did you check the table definition to look for indexes that may be on two or more fields?

    John

  6. #6
    dlaprade is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2012
    Posts
    4
    @jzwp11

    That did it! Thanks so much. This has been driving me crazy. How did you search for duplicates?

  7. #7
    dlaprade is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2012
    Posts
    4
    @John

    Thanks to you too! Looks like the problem is resolved now.

  8. #8
    jzwp11 is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2010
    Location
    Dayton, OH
    Posts
    2,901
    I imported into a table and let Access add its own primary key. I then used the find duplicate query wizard based on the ORFName field. I've attached a copy of the database.
    Attached Files Attached Files

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

Similar Threads

  1. Replies: 2
    Last Post: 04-23-2012, 01:04 AM
  2. Replies: 3
    Last Post: 10-11-2011, 01:43 PM
  3. Replies: 37
    Last Post: 08-10-2011, 09:43 AM
  4. Replies: 9
    Last Post: 07-14-2011, 07:20 AM
  5. index/primary cannot contain null value
    By BinHDreW in forum Access
    Replies: 1
    Last Post: 05-26-2011, 08:25 PM

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