Automatic fil the foreign key

F

Frank Situmorang

Hello,

I tried to undestand Contact data base, sample in the MS Access. I can not
found on which form the Contact id filled, because I see the sampel it was
field.

Can anyone tell me?

With many thanks
 
M

Mark A. Sam

Hello Frank,

I don't have a copy of Northwind on my machine, so I am going to guess that
ContactID is an autonumber field. You can verify this by opening the
Contacts table in design view and look at its Data Type. If it is an
autonumber field it is populated automatically whenever a new record is
entered on the Contacts form. If there is a subform on the Contacts form,
and it contains ContactID and is the LinkChildFields and LinkMasterFields
value, then it also is populated automatically when a new record on the
subform is entered.

God Bless,

Mark A. Sam
 
F

Frank Situmorang

Thanks Mark for your kind repsonse. Waht do you mean by linked child fields
and linked master fields. Is'nt it because the referenctial integrity is
tikced?

Can you explain more the qonsequencies of referenctial integrity is ticked.
 
M

Mark A. Sam

Two of the properties on a Subform control are LinkChildFields and
LinkMasterFields. This tells Access which fields relate the underlying
tables of the main form and subform. In your case it would be ContactID.
If the properties each say ContactID then Access will automatically populate
ContactID in the subform. Referential integrity doesn't do this.
Referential integrity will keep the relationship between the main table and
subtable intact, so that it can deleted the subtable records the
corresponding records are deleted in the main table or update the linking
field when the main table field is updated, to keep them in sync.

The relation between a main table and subtable can be established either
automatically using LinkChildFields and LinkMasterFields propertied of a
subform, by programming, or manually by opening the tables and typing the
values into the fields.
 
Top