Relationship

  • Thread starter Thread starter PJ
  • Start date Start date
P

PJ

I created 5 Tables:

1)Office with Primary Key as auto number named Office ID
2)Marketer with Primary Key as auto number named Marketer ID
3)Currency with Primary Key as auto number named Currency ID
4)Client Name with Primary Key as auto number named Client ID
5)Client Ticket with Primary Key as auto number named Client Ticket ID

I have Client ID in each of the other 4 tables and Client is the
relationship by Client ID. When I test and add a new client it is not
showing up in the other tables. I do not think I set up the database design
correctly. Any suggestions??

Thank in advance.
 
The client will not show up automatically in the other tables and for a good
reason. You could have a new Customer that hasn't created an Order yet.
Therefore you don't want a record in the Orders table.

Now if you want Access to automatically create a matching record in another
table when needed, it will. You first need to create these relationships in
the Relationship Window. Enable Referiential Integrity (I don't usually like
Cascade Delete and if you are using Autonumbers for the PK, you shouldn't
need Cascade Update).

Next create a form based to the topmost table. In your description, Client
Name seems to be this table. Next use the subform wizard to create subforms
for the other 4 tables on your Client Name table. Then when you add an Office
to that Client Name, Access should insert the proper FK. You might want to
create a tab control to handle that many subforms.

Also make sure to get the relationships pointed in the right direction. Can
a Client have many Offices OR does an Office have many Clients? Very
important.
 
I created 5 Tables:

1)Office with Primary Key as auto number named Office ID
2)Marketer with Primary Key as auto number named Marketer ID
3)Currency with Primary Key as auto number named Currency ID
4)Client Name with Primary Key as auto number named Client ID
5)Client Ticket with Primary Key as auto number named Client Ticket ID

I have Client ID in each of the other 4 tables and Client is the
relationship by Client ID. When I test and add a new client it is not
showing up in the other tables. I do not think I set up the database design
correctly. Any suggestions??

Access will NOT automagically create new records or field values in other
tables just because you add a new client. A relationship *prevents* the
addition of an invalid record; it doesn't (and needn't and shouldn't) create
empty placeholder records.

Doublecheck your logic, as well. If you put the ClientID field in the Office
table, that means that that office can service one, and only one, client;
similarly with Marketer; similarly with Currency. I doubt that is your intent!
If each Office can service many Clients, but each Client is served by only one
Office, then you need an OfficeID field in the Client table, not vice versa.
The foreign key goes in the "many" table, not in the "one".
 
Back
Top