Results 1 to 2 of 2
  1. #1
    RhinoCan is offline Novice
    Windows 8 Access 2013
    Join Date
    Jun 2015
    Posts
    10

    Can't save new empty table due to nulls in primary key

    I am getting exasperated.

    I have a lot of experience with relational databases, particularly DB2, but am trying to prototype something in Access just to see how it compares. I'm in design mode in Access 2013 and am trying to create a simple table with just two columns, Meeting_Date, which will contain a date in the format YYYY-MM-DD ("short date" in Access terms), and Meeting_Comment, which is defined as a Long Text field. I've defined a Primary Key on Meeting_Date and I've deleted the autonumbered ID field that Access generates automatically as the first column in a table. All of that went fine.

    However, when I try to rename the table, it tells me that I need to Save the table first. I suppose that's reasonable. When I try to save the table, it complains that "Index or Primary Key cannot contain a null value". I understand that Primary Keys cannot contain null values. In fact, I expect that defining a column as a Primary Key will ensure that Access will not accept a null Primary Key value: that's certainly what happens in DB2. I am completely baffled why I am getting this message NOW since the table contains NO DATA yet.

    What do I need to do to be able to save this very simple table? Also, can I be sure that when I have successfully saved the table, that any row for which I supply a null Primary Key will be rejected by Access? (By the way, if I'm inserting a row with a form or the table view, how do I indicate a null, as opposed to a blank? Or will Access treat an empty input field as a null automatically?)

  2. #2
    RhinoCan is offline Novice
    Windows 8 Access 2013
    Join Date
    Jun 2015
    Posts
    10
    I solved my own problem. I created the table again, doing the same things, and it worked fine this time. Then I deleted the two columns from the first table, the one that wouldn't save, and then deleted the first table.

    I don't know why it wasn't co-operating the first time.

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

Similar Threads

  1. Replies: 8
    Last Post: 01-01-2015, 07:34 PM
  2. Replies: 4
    Last Post: 03-10-2014, 06:16 AM
  3. Replies: 2
    Last Post: 04-23-2012, 10:13 PM
  4. Replies: 9
    Last Post: 01-20-2011, 02:22 PM
  5. Replies: 1
    Last Post: 07-14-2008, 12:15 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