Foreign key not showing up in some tables?

pityocamptes

Registered User.
Local time
Yesterday, 20:13
Joined
Dec 8, 2010
Messages
27
Is there a way to force access, or perhaps I am doing somethign wrong, to save the primary key into a related tables foreign key? For example I have one primary table with a primary key (UserID) set to autonumber. I have a couple of other tables related to this primary table and they use UserID as a foreign key. I have a one to many for relationship with referential integrity, and cascade set in the relationship properties. However, when I go to use a report the foreign keys are not being printed out. In fact when I look at the tables with the foreign keys the UserID from the primary table is not in the field. Not sure what to do? The tables seem to work fine and the data is being stored as per the relations, but for some reason the foreign key is not being stored in the field, and thus I can't print it out in my reports!!! Help. Thanks!!
 
Cascade updates don't have anything to do with this. The foreign keys don't automatically get entered UNLESS you create a form/subform with the main form having the parent table as the record source (or a query based on it) and the subform having the child table as its record source and the Master/Child links set to the appropriate PK/FK field - so Master would have the PK field listed and Child link would have the FK field listed.

Then when you enter a record into the form and add a subform record, the FK will populate automatically. It won't work if you try to work in tables or queries directly.
 
Cascade updates don't have anything to do with this. The foreign keys don't automatically get entered UNLESS you create a form/subform with the main form having the parent table as the record source (or a query based on it) and the subform having the child table as its record source and the Master/Child links set to the appropriate PK/FK field - so Master would have the PK field listed and Child link would have the FK field listed.

Then when you enter a record into the form and add a subform record, the FK will populate automatically. It won't work if you try to work in tables or queries directly.


Thanks! So how do I fix this? I pretty much am done with the tables, forms, etc. Was working on the reports and noticed that the FK was not printing which lead me back to the tables and the FK not in the child tables. Thanks!!
 
So how do I fix this?

1. you will need to populate any existing missing items manually or by an update query.

2. You need to ensure your form/subforms are set up properly.

3. If you want to post a copy of the database (with bogus data) someone here might be able to look at it and make suggestions.
 

Users who are viewing this thread

Back
Top Bottom