relational problems

Andren

Registered User.
Local time
Today, 06:11
Joined
Sep 3, 2002
Messages
55
I have a problem with my relations....

I have set upp a data structure where I have ome main parent table ("Cassification") and several child tables ("Authors", "Subject" etc etc). The "many-tables" are joined to the parent table via ´"LittNr". that is a primary key (autonumber).

In every child-table I have the same "LittNr" as a number field.

When I try to put in data through my forms (based om queries)
I get a error message (3201) saying that I can not add or change a reccord because a related reccord is required.

In my forms I do not however have a field recording "LittNr" (because I thought that Access could do the record-counting all by itself. Is this the problem or what am I doing wrong???

I very much would appreciate any helpful hint on this because tomorrow I'm meeting my dead-line.

Thanks.

/ Anders
 
From your description I am not sure if you have your tables set up correctly or not, but if you have a One to Many Relationship you tables should look like this:

tblClassification
ClassificationID (Primary Key and autonumber)
....other fields...

tblAuthors
AuthorID (Primary Key and autonumber)
ClassificationID (Foreign Key)
...other fields...

tblSubject
SubjectID (Primary Key and autonumber)
ClassificationID (Foreign Key)
...other fields...

It almost sounds like Authors and Subjects are Lookup tables and not really child tables, but I cannot be sure because I do not know the purpose of your 'main' table.

Anyway make the Subject and Author forms subforms of the Classification form and be sure you have your relationships set up in the relationship window and that Referential Integrity is checked. Now you can add subjects and authors without a problem....

hth,
Jack
 
I have a couple of relations that give me trouble too. One of my brothers always seems to need money :)

The only time Access will populate a foreign key for you is in a bound subform that is properly linked to a main form. In any other case, you'll need to populate the foreign key yourself.
 

Users who are viewing this thread

Back
Top Bottom