one to many relationship. Changing PK names

Lifeseeker

Registered User.
Local time
Today, 07:41
Joined
Mar 18, 2011
Messages
273
Hi guys,

I have a one to many relationship set up. The PK is not set on the Autonumber on the primary table.

Users can now add a new record into the primary table through the main form. There is also a subform that shows records hitched onto the record in the primary table.

I have ran into a problem where if the PK on the primary table changes(name changes)(PK is text-based), then all the corresponding information related to the previous PK is lost. For example, if 0353 changes to 03456, then all the information related to 0353 in the subform is lost.

Is there any way to prevent this from happening? Will changing the PK to AutoNumber on the primary table solve the problem?

Thoughts/comment much appreciated.
 
You choice of a value that can change as a PK is inappropriate. Long Integers make better PKs anyway because they are much faster than text.

However if you so desire you can overcome the problem by turning on Cascading Updates in the Releationship. Personally I would not do that but rather add another field as the key instead.
 

Users who are viewing this thread

Back
Top Bottom