473,396 Members | 1,724 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Index or primary key cannot have a null value

26
Hello again,

I have a problem with one-to-one relationships (with tables :p). I have seperated a large table into four smaller tables - EmployeeDetails, MRSADetails, DiseaseHistory and NeedleStick. I have made sure all of the tables contain the same number as a primary key in an 'id' column. I have made one-to-one relationships with referential integrity, cascade delete and cascade update enabled.

I have made a form with the record source set to EmployeeDetails and have included subforms for the other three. The forms are linked correctly and using the navigation buttons down the bottom i have ensured they are all displaying relevant details. The problem comes when i wish to enter a new employee (using the arrow with the * navigation button at the bottom). I immediately get an error message saying "index or primary key cannot have a null value".

Any help would be appreciated as always!
Dec 18 '07 #1
1 4261
PianoMan64
374 Expert 256MB
The reason that you are getting that error message is because when you go to add a new record into the main form, there isn't one in any of the other three tables that you have linked together. You need to be able to pass that value to the other table so that you can add records accordingly. Since you are using the same ID for all tables you're going to have that problem until you remove all that referrencing that you have setup and do it through VBA to make sure that when each section is filled out, that you pass the correct RecordID to each table to maintain the relationship between all four tables.

Personally this is a very bad design because it makes it very very easy that if the application crashes, that you loose the data integraty.

If the reason that you've split the table up to 4 tables was because of size, then I would think about going to another backend platform like MS SQL or MySQL or Oracle. This way you don't run into that 2gig limited that is placed on MS Access tables.

Hopefully that helps,

Joe P.
Jan 5 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

10
by: BuddhaBuddy | last post by:
Platform is DB2/NT 7.2.9 The table was created like this: CREATE TABLE MYTEST ( MYTESTOID bigint not null primary key, FK_OTHEROID bigint not null references other, FK_ANOTHEROID bigint not...
1
by: JBrow | last post by:
Hi everyone, I have a form with several fields. One represents the primary key. If you leave it blank and try to save the record, the forms displays the following error message - "Index or...
7
by: teddysnips | last post by:
Table DDL below: The tables I have contain Timesheet information. Each row in the tblTSCollected table contains an entry for an employee into the timesheet system, specifically by scanning the...
15
by: rAinDeEr | last post by:
Suppose i have a table which holds thousands of records with the following structure CREATE TABLE "test "."T_CNTRY" ( "CNTRY_CDE" CHAR(2) NOT NULL , "CNTRY_NAME" VARCHAR(50) ) and i have...
7
by: Cyberwolf | last post by:
Is there a way to set a primary index to ignore Nulls and if so how would I do it. I have already tried setting it so it is not a required field, but that does not work. It states that the field...
2
by: Gregc. | last post by:
G'day I wish to make the commitment line times the Primary Key. There are no duplicates, and the data type is Number. However whenever I try this, the Error Message 'Index or Primary Key Cannot...
10
by: Laurence | last post by:
Hi there, How to differentiate between unique constraint and unique index? These are very similar but I cannot differentiate them? Could someone give me a hand? Thanks in advance
6
by: john | last post by:
Last week I posted about making a unique index on multiple fields to prevent importing identical records twice. I still have trouble with the nulls in the index. The only way that I can make it...
12
by: Aidan | last post by:
I have a form to create a new record for a training course. The form is based on one table that has 4 keys set to primary key. The first combo box on the form allows selection of the course POP...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.