Auto populate related primary Key

Gueven

New member
Local time
Today, 03:06
Joined
Jun 8, 2021
Messages
2
Hello,

I am creating a database right now and I have a table with a Primary Key that is linked to another table with a 1 to 1 Relationship.

I created a query and used all the fields that I wan´t to edit with a form.

My problem is, if i don´t fill a field, that is linked to the second Table with the primary Key, and I Save the record, I can´t edit the fields that are linked to the second table anymore, because the primary key for the second table wasn´t generated.

So I thought I could autofill the forgein keys, but it is harder than I thought.

Does anyone know a way to do that?
 
Whilst not totally wrong - there are very few legitimate reasons to have a 1 to 1 relationship.
Perhaps you could explain the tables and briefly the data you are attempting to manage.

As to your problem, I suspect it is because you need to set up the child/master relationship in the form and use a subform limited to display one record.

A query won't magically create a matching PK ID, ideally one needs to be a PK and the other an FK otherwise you can't ever add a record to either table.
 
why 1 on 1, when you can have it all in 1 table.
use Query and Left join the other table and not use Inner Join.
 
Hey thanks for the answers,
I decided to combine the tables in one table.
I already used left joins the displaying of information was not the problem, the edtiting the second table after a save was.
Anyway seems like a 1-1 Relationship just makes it harder to use queries.

Thanks
 

Users who are viewing this thread

Back
Top Bottom