Discussion Locked

Access 97 relational question

0 helpful
3 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I have converted (from another database) and am working in a relational (8 tables) access 97 database. I have a main form (based on queries involving the parent and several child tables) where data is entered that corresponds to several tables. (My relationships are set up with enforced referential integrity and cascade update and delete). Existing records in the parent and child tables are fine. When I enter new records in the form however there is a problem. Putting data in fields that correspond to the child tables produces an error saying the primary key can't contain a null value (b/c it doesn't automatically add a corresponding [primary key] record to the tables). I put in a macro so that when users click in the field it sets thevalue of the index field of the child to that of the parent table and it works fine, but I feel like it should do that automatically since it is just a basic relational set up.

Would love any suggestions!

3 replies

by haris

You might be attempting to add records in a child table without the master records. Make sure that for the records you are entering there is a record in the referenced table. Access will not allow you to create records in related tables untill the parent table has a record.

Try putting your related records as subforms. With this setting access will add the parent record for the parent forms.

by kdjenk

Well, I suspected that at first too, but that doesn't seem to be the problem. There are indeed records in the master table when this problem occurs. Instead, it seems that Access somehow isn't recognizing that, even though my relationships are defined.

This discussion is closed to new replies.