Last post Aug 21, 2015 06:36 PM by hans_v
Aug 14, 2015 06:47 AM|EllieC|LINK
I have created a database which contains 8 different tables to store individuals competencies. Each table includes the user id, surname and first name of the individual along with other information. The user id is set as a primary key and can have no duplicates
whereas the first name and surname can contain duplicates. This works fine however when the new data is inputted into the form the error message of "Index or Primary Key cannot contain a Null Value". Does anyone have an idea why this might be happening?
Aug 14, 2015 11:21 AM|DeadTroll|LINK
Not sure how you are inserting your records, but one of tables that you are inserting to does not contain a primary key value. If you would post your sql, I'm sure we can help you figure it out.
Aug 21, 2015 01:23 AM|Li Wang|LINK
Thank you for your post, @deadtroll is right, the error happens because you tried to add a new record but did not enter a value in the field that contains the primary key. to solve this problem, you must provide a value in the primary key field when inserting.
I will temporary mark reply of @deadtroll as answer, if you have future question, please feel free to let us know.
Aug 21, 2015 06:36 PM|hans_v|LINK
This works fine however when the new data is inputted into the form the error message of "Index or Primary Key cannot contain a Null Value". Does anyone have an idea why this might be happening?
When using Access, you need to set the Primary Key Column to an Autonumber Field. This will create a new value everytime you create a new record. When using SQL Server, you need to change the column to be an Identity column.