A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Database Design
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Avoiding duplicate fields in a table



 
 
Thread Tools Display Modes
  #1  
Old January 13th, 2010, 03:15 PM posted to microsoft.public.access.tablesdbdesign
PVANS
external usenet poster
 
Posts: 7
Default Avoiding duplicate fields in a table

Good morning

Please can someone help me with this:

I have a table tblCommission which has the following fields:
Commission_ID (primary key)
Client_account (related to the field Client_account in tblClients)
Product_Code (related to the field Product_Code in tblProducts)
Commission
Exchange

I need a method to ensure that each client can only have one commission per
product.... all clients should (and do) have the ability to have a commission
for all the possible products, but I need to protect my database from the
scenario I have shown below:

Commission_ID Client_account Product_code Commission Exchange
1 000001 Coke 2
$
2 000001 Coke 1
$

Please could someone suggest a method to protect the table from this
scenario occuring?

Thank you for the help, I really appreciate it.
  #2  
Old January 13th, 2010, 06:50 PM posted to microsoft.public.access.tablesdbdesign
Piet Linden[_2_]
external usenet poster
 
Posts: 280
Default Avoiding duplicate fields in a table

On Jan 13, 8:15*am, PVANS wrote:
Good morning

Please can someone help me with this:

I have a table tblCommission which has the following fields:
Commission_ID (primary key)
Client_account (related to the field Client_account in tblClients)
Product_Code (related to the field Product_Code in tblProducts)
Commission
Exchange

I need a method to ensure that each client can only have one commission per
product.... all clients should (and do) have the ability to have a commission
for all the possible products, but I need to protect my database from the
scenario I have shown below:

Commission_ID * Client_account *Product_code * Commission * Exchange
1 * * * * * * * * * * * * * * * * 000001 * * * * * * *Coke * * * * * * * * 2
* * * * * * * * *$
2 * * * * * * * * * * * * * * * * 000001 * * * * * * *Coke * * * * * * * * 1
* * * * * * * * *$

Please could someone suggest a method to protect the table from this
scenario occuring?

Thank you for the help, I really appreciate it.


Add a unique index to (Client_account, Product_code) and you will not
be able to enter duplicates *ever*, so if this is a "sometimes" rule
instead of an "always" rule, you'll have to rethink your strategy.
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 05:23 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.