View Single Post
  #4  
Old October 27th, 2008, 01:01 PM posted to microsoft.public.access.tablesdbdesign
Stefan Hoffmann
external usenet poster
 
Posts: 991
Default VBA for Primary Key

hi Frank,

Frank Situmorang wrote:
The very low level office is local church, then chruch will send it;s member
data to higher office which is regional to consolidate data of all churches
on its region. Then Regional officie will send it's data to higher level
office wchich is Union Office...and so forth upto Division Office..and
consolidated all divisions to have the world total members.

So you have

Division: ID, ... PK(ID)
Union: ID, Division_ID, .. PK(ID)
Region: ID, Union_ID, .. PK(ID)
Church: ID, Region_ID, .. PK(ID)
1, 1, "Church P"
1, 2, "Church Q"

as invariant structural tables.

Your local offices fill data in your address table:

Address: ID, Church_ID, ...

But if we do not do like that, let me show you the sample, Address Mr. A in
church P will start with the number 1, then when I give the blank database to
church Q and the address of Mr. B will also start wtih number 1. When both
churches sent their data to regional office, the primary key will
conflict./duplicate.

Address (Church P): 1, 1, "Mr. A"
Address (Church Q): 1, 2, "Mr. B"

The surrogat key ID in church is sufficent for your local office, but
when you are consolidating the data your are copying data into another
structural scheme which has _other_ primary keys. For the table Church
it is then a combined key consisting of ID and Region_ID or you need an
other table to hold the consolidated data:

Address (Consolidated): ID, Original_ID, Church_ID, ...

Depending on your needs you may consider using a GUID as unique id, e.g.

http://www.devx.com/dbzone/Article/10167/0/page/3


mfG
-- stefan --