data not being stored in tables

mlandon99

New member
Local time
Today, 07:48
Joined
Nov 18, 2014
Messages
5
Hello - I'm having an issue with my DB. Pretty sure it's a simple fix, but I can't seem to figure it out. I have a database with numerous tables. I have set up relationships between all tables (they are all pretty one-to-many relationships). I then created forms in which to enter and view data. Data entry is fine; however, when I go into my tables, I realize that it is not storing the ID# for related tables in the main table. For example - I have a table called "ContractTypes" with a field for ID#. That table is linked to the main table called "Contracts. In the form, I have the ContractType as a lookup field, I select the one I want for this entry, but it is not storing that ContractTypeID into the Contracts table. Also, when I go back into the form to enter a new record, the data on the subforms is from the previous record and not the record I'm currently working on. In other words, it does not appear to be linking the ID#s from the different tables. Can anyone help?:)
 
Normally you have a Primary Key in the Main form and a Fake Key for the Sub form. Is this not the case? Example:

tblContracts 'Main Form.
ContractID PK

tblContractType 'Sub Form.
ContractTypeID PK
ContractID Number FK
 
that is correct. In my "Contracts" table (which the "many" side of the relationship), I have both a Primary Key "ContractID" and a fake key called "ContractTypeID" which is the primary key I the table "ContractTypes" (the "one" side of the relationship). In addition, in the ContractTypes table, I have the primary key "ContractTypeID" and a secondary (fake) key called "ContractID" from tblContracts. Perhaps that is where my problem is? Should I only have a secondary key in one side of the relationship? If so, would it be in the "one" side or the "many" side? Appreciate your help.
 
The subform should be linked to the main form from just ONE and the correct Fake Key.
I believe it should be ContractID
 
FK = "Foreign Key"
Nothing "fake" about them at all.
 
Show the FK on your SubForm to make sure you get it right.
If you linked the forms correctly it should be the PK of the TopForm.
 

Users who are viewing this thread

Back
Top Bottom