By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,984 Members | 997 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,984 IT Pros & Developers. It's quick & easy.

Creating a one to one relationship

P: 43
Hi,
I have a 'Client table' and a 'Credit Card table' that need to be seperated for security reasons but I am not sure how you set up the one to one relationship. I currently have the two Primary Key fields ('Client ID' and 'Cardnumber') linked together and this appears as a one-to-one relationship in the relationships table. However, I am not sure if this is correct as the cardnumber field will not let me change the properties e.g. input mask and data type for a credit card number and defaults to those of the clientID.

Am I doing something wrong? More details including field names can be included in necessary.

Many thanks in advance for any help

Edd
Mar 8 '07 #1
Share this Question
Share on Google+
5 Replies


NeoPa
Expert Mod 15k+
P: 31,347
You would need a ClientID field (or equivalent) in both tables.
It would be PK in the 'Client Table' and FK in the 'Credit Card Table'.
Mar 9 '07 #2

MMcCarthy
Expert Mod 10K+
P: 14,534
Edd

As NeoPa says the tables should be as follows:

tblClients
ClientID (Primary Key)
ClientName

tblCreditCards
CardNumber (Primary Key)
ClientID (Foreign key referencing the primary key of tblClients)

The relationship between these two tables is based on the ClientID. Now you need to do two things.
  1. In the tblCreditCards table, set the indexed property of the ClientID to Yes (No Duplicates). This will enforce a one to one relationship
  2. click on the relationship in the relationship and tick the referential integrity and cascade boxes.
Mary
Mar 10 '07 #3

P: 43
Many thank to both NeoPa and Mary for your great advice.

You have been really helpful in the creation of my database and I will undoubtedly return for some more assistance - if you can put up with me that is!

All help is very much appreciated and this is a truly wonderful service.

Best wishes and I hope to be able to help people also in the near future.

Edd
Mar 11 '07 #4

MMcCarthy
Expert Mod 10K+
P: 14,534
You're welcome.

Mary
Mar 11 '07 #5

NeoPa
Expert Mod 15k+
P: 31,347
Many thank to both NeoPa and Mary for your great advice.

You have been really helpful in the creation of my database and I will undoubtedly return for some more assistance - if you can put up with me that is!

All help is very much appreciated and this is a truly wonderful service.

Best wishes and I hope to be able to help people also in the near future.

Edd
That's a great attitude.
We can never have too many experts.
Mar 11 '07 #6

Post your reply

Sign in to post your reply or Sign up for a free account.