primary key changing to 0

  • Thread starter Thread starter lissahoo
  • Start date Start date
L

lissahoo

Hi,
I'm having trouble adding records to secondary tables via query.

I have Table1 with PO# as the primary key and I have Table2 with sPO#
as they key. I have them left joined in a query, but when I try to
place a value in a field in Table2, the PO# field of Table1 changes to
0. I was expecting the PO# to be automatically added as the key for a
new record in Table2.

Any ideas?

Thanks
 
Hi,
I'm having trouble adding records to secondary tables via query.

I have Table1 with PO# as the primary key and I have Table2 with sPO#
as they key. I have them left joined in a query, but when I try to
place a value in a field in Table2, the PO# field of Table1 changes to
0. I was expecting the PO# to be automatically added as the key for a
new record in Table2.

Any ideas?

Why would you expect that? Except for cascade update and cascade deletes,
relationships do not cause values in related tables to "automatically" do
anything.
 
But why is the value of the key in Table1 changing to 0?
I have tried cascading and it didn't change what is happening.
 
But why is the value of the key in Table1 changing to 0?
I have tried cascading and it didn't change what is happening.

My best guess would be because zero is the default value for that field in the
design of the table.

The behavior you appear to want is achieved by using a form and a subform.
Those can have links defined so that values in the parent record are
automatically propagated to new records entered in the subform. I would not
recommend trying to use joined table queries for data entry.
 
Back
Top