dbTalk Databases Forums  

primary key

comp.database.ms-access comp.database.ms-access


Discuss primary key in the comp.database.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
delores h.
 
Posts: n/a

Default primary key - 01-10-2004 , 10:32 PM






I am having a problem with primary keys. I have a main table called
Transactions. It's primary key is made up of three fields (date,
account, amount) so that Access will catch any bills that I try to
enter more than once.
There is another field, transactionID, that is an autonumber assigned
to each record. TransactionID is linked to another table called
Distribution. I need this link to perform cascade updates and
deletes. When I attempt to do this, Access will not allow me to
because this field is not a primary key. Any ideas as to how I can
make this work?

Reply With Quote
  #2  
Old   
Art Yates
 
Posts: n/a

Default Re: primary key - 01-11-2004 , 09:46 AM






Make Transactional your primary key.
(date, account, amount) are attributes of your primary key.
Semantic keys should not be used in a primary key, it is bad database
design.
You can catch your duplicates with a 'find duplicates' query

Art Yates


"delores h." <dhildebrandt (AT) shaw (DOT) ca> wrote

Quote:
I am having a problem with primary keys. I have a main table called
Transactions. It's primary key is made up of three fields (date,
account, amount) so that Access will catch any bills that I try to
enter more than once.
There is another field, transactionID, that is an autonumber assigned
to each record. TransactionID is linked to another table called
Distribution. I need this link to perform cascade updates and
deletes. When I attempt to do this, Access will not allow me to
because this field is not a primary key. Any ideas as to how I can
make this work?

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.559 / Virus Database: 351 - Release Date: 1/7/2004




Reply With Quote
  #3  
Old   
Ira Solomon
 
Posts: n/a

Default Re: primary key - 01-11-2004 , 11:12 AM



Art is right, but I should point out that you can create a multiple
field index other than the primary key.
If you goto to View/indexes while in table design view you can place
an index name in the left column, and the list of fields in the right
column, one per row.
The make the name (not the fields) unique and you will have the same
situation as before. You will be prevented from entering dups.

Good Luck

Ira Solomon

On Sun, 11 Jan 2004 15:46:59 GMT, "Art Yates"
<aeyates (AT) workerscomp (DOT) com> wrote:

Quote:
Make Transactional your primary key.
(date, account, amount) are attributes of your primary key.
Semantic keys should not be used in a primary key, it is bad database
design.
You can catch your duplicates with a 'find duplicates' query

Art Yates


"delores h." <dhildebrandt (AT) shaw (DOT) ca> wrote in message
news:e0bf09d6.0401102032.658ff9 (AT) posting (DOT) google.com...
I am having a problem with primary keys. I have a main table called
Transactions. It's primary key is made up of three fields (date,
account, amount) so that Access will catch any bills that I try to
enter more than once.
There is another field, transactionID, that is an autonumber assigned
to each record. TransactionID is linked to another table called
Distribution. I need this link to perform cascade updates and
deletes. When I attempt to do this, Access will not allow me to
because this field is not a primary key. Any ideas as to how I can
make this work?


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.559 / Virus Database: 351 - Release Date: 1/7/2004



Reply With Quote
Reply




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 On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.