Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Primary not updating Foreign Keys in other tables?

Status
Not open for further replies.

kermitforney

Technical User
Mar 15, 2005
374
US
Not sure why this is happening but I have all of the relationships set up correctly. I also have the Master/Child settings setup in my subforms.

Any reason why this would be happening?
 
Any reason why this would be happening?" what is happening? Could you provide some details regarding what you are experiencing?

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
When there is a record created in the main table, it's primary key isn't being populated in the foreign keys of the other tables that it is related to.

 
Is all of your data entry done in a form and subform? What are the primary and foreign key fields in your tables? What are the Link Master/Child properties of your subform control?

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
Are you actually creating entries in the 'other' tables from the form/subform?

Greg
"Personally, I am always ready to learn, although I do not always like being taught." - Winston Churchill
 
(((dhookom)))

1.) All of the data entry is done in one form/subform.

2.) The primary of the main table is Autonumber and the foreign key counterparts are all set to Number.

3.) Master fields are set to the main table and Child fields are set to the subforms table which has a relationship with the main table.
 
Is it bad form to have a query select ALL of the tables and place them on one form?

Or should I have the main tables data on the main form and present all of the related tables information on subforms?
 
I would have expected you to provide some table and field names as well as your actual property settings on your subform control.

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
Like the others, I'm a bit unclear on your problem.

You say "updating" the foreign keys, but then in your second post you talk about creating a new record in your main table. This won't automatically create a new record in your related tables. Is this what you're trying to do, OR

Are you trying to make the related records UPDATE if you change a record in your main table?

The latter is an idea called "Cascading Updates" and is the process whereby a key change in the master table is cascaded through all the occurances of that same value (as a foreign key) in any child tables. Cascading Updates are turned on in the properties of a link between tables.

To clarify, if I have Cascading Updates turned ON, and I change key value "X" to 1234, the database engine will automatically update all values of 1234 that are foreign keys in the other related tables.

So far as I know, there is no automated process what will INSERT a new record in a child table just because you've added a new record in to the parent.





Don't be sexist - Broads hate that.
 
In the subform, try setting the default value of the foreign key fields (i.e. new records) to the value from the main form.

Greg
"Personally, I am always ready to learn, although I do not always like being taught." - Winston Churchill
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top