Problem entering new records in the form

richardm55

Registered User.
Local time
Today, 14:44
Joined
Feb 9, 2014
Messages
28
I've created simple data base with 2 connected table with relationship one to many, then I have built the querry based on those 2 table and then I have done the form based on this querry, so there are fields from those 2 tables in the form.

When I try to fill in the fields with information I get error message:
"You can not add record (records); missing foreign key in the table"

When I checked relationship property window everything seems to be ok. Any advice in this matter is very welcome and thank you in advance.
 
Probably: If Your Form is based on a query then the Relational Key fields from the tables are not all in the query or not on the form and one of them requires an entry.

This begs the question 'Are you using RELATIONSHIPS correctly?'

Cheers
Goh
 
A form that directly interacts with data (add/edit/delete) should be based on just one table.

In your instance, you should have a Main form based on the table on the one side of the relationship. Then, you should have a subform on it which would be based on the many side of the relationship. 1 form, 1 table.
 
Probably: If Your Form is based on a query then the Relational Key fields from the tables are not all in the query or not on the form and one of them requires an entry.

This begs the question 'Are you using RELATIONSHIPS correctly?'

Cheers
Goh
Thank you mate for your help. I have really forgotten to include one relational key in the query and after adding it all works!!!
 
I still have different problem. I can type values in the fields of form now but when I select value from combi controls which is fixed with field of name instead of its id I get error message now that this key can not have null value.
I can not understand this if I select name so associated its id should be asigned automatically by taken its value from its table.
 
I have partly solved my problem. I have just build another data base from scratch and new works now. I don't know what was wrong before. What I changed was I set type of primary key for second table as autonumber.
 
Also, plog's post #3 is very important.
 
But I've done the form based on fields taken from tables and it works but before you must make query having fields of those 2 tables and then I create the form based on this query.
 
The choice is yours. If you are happy with what you have, great. If you run into future snags, consider a form with a subform where each form is based on a single table.
 

Users who are viewing this thread

Back
Top Bottom