Problems with relationships

Atamagaokashii

New member
Local time
Today, 21:35
Joined
Apr 12, 2008
Messages
3
Okay, I thought I'd make it easier, so I took a few screenshots, and came up with this.
When ever I try to force referential integrity, I get this message. Can anyone tell me what I'm doing wrong?

relationshipproblemsyd0.png
 
Well, first of all, your tables aren't set up properly. Your Booking table should NOT have CUSTOMER ID as its Primary Key. It should have its own primary key and the CUSTOMER ID is a FOREIGN key from the Customer table. The Customer ID would link the two tables, but you don't link the two primary keys. You link the primary key of one table to the foreign key of the second.

In the current setup you have, a customer can ONLY have a single booking EVER. So, you need to change the types like I suggest. The Customer ID (you should name them the same in the tables to make it easier to see the relationships too) in the CUSTOMERS table, should be an Autonumber and the Customer ID in the Bookings table should be LONG INTEGER (which is what the datatype of the autonumber is, but since it is the FOREIGN KEY it needs to be Long Integer. Also, you can't link two autonumber fields as you will not get results you might expect.
 

Users who are viewing this thread

Back
Top Bottom