dbTalk Databases Forums  

Problem with Primary Keys

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


Discuss Problem with Primary Keys in the comp.database.ms-access forum.



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

Default Problem with Primary Keys - 01-11-2004 , 10:40 AM






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   
Larry Daugherty
 
Posts: n/a

Default Re: Problem with Primary Keys - 01-12-2004 , 02:13 AM






Make TransactionalID the Primary Key (that's the only intended use of the
Autonumber field). Cascading updates and deletes should now work. Any
child tables should have the Primary Key of the Parent table entered as a
long integer foreign key.

Note that the content of an autonumver field should never be visible to a
human. While it is pretty well going to yield unique numbers, they are not
guaranteed to be in a gapless sequence.

HTH
--
-Larry-
--

"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?



Reply With Quote
  #3  
Old   
Felovala
 
Posts: n/a

Default Re: Problem with Primary Keys - 01-15-2004 , 09:38 PM



I agree, but you might want to also add a secondary index to your main table
that will continue to catch the duplicate bills.

Good Luck.

"Larry Daugherty" <ladaugherty (AT) NoSpam (DOT) earthlink.net> wrote

Quote:
Make TransactionalID the Primary Key (that's the only intended use of the
Autonumber field). Cascading updates and deletes should now work. Any
child tables should have the Primary Key of the Parent table entered as a
long integer foreign key.

Note that the content of an autonumver field should never be visible to a
human. While it is pretty well going to yield unique numbers, they are
not
guaranteed to be in a gapless sequence.

HTH
--
-Larry-
--

"delores h." <dhildebrandt (AT) shaw (DOT) ca> wrote in message
news:e0bf09d6.0401110840.20d9415b (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?





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.