Re: do all primary keys use autonumber
- From: Vincent Johns <vjohns@xxxxxxxxxxxxxxxxxx>
- Date: Thu, 10 Nov 2005 10:47:01 GMT
k wrote:
do all primary keys use autonumber
(Point of netiquette: It's considered good form to put your actual question into the body of a message.)
No, of course they don't. But Autonumber is a convenient way to be sure that you won't have any duplicate values, and an Autonumber field occupies only about 4 bytes per record, much shorter than many other fields you might choose to use.
Your primary key could even consist of more than one field, for example using both [First Name] and [Last Name] (assuming you don't have two people named "Mary Jones").
If you don't use Autonumber, you'll need to get your key values from somewhere, and Access is likely to complain to you if a new key value matches some existing one, as they must be unique in the Table. In such a case, you'll need to choose some other value, and if you were trying to enter a name, you will have to modify it somehow, such as by changing "Mary" to "Mary_1".
To avoid confusing my Autonumber values with something meaningful (such as people's ages), I usually set the "New Values" property of the field to Random, making it obvious that they're keys.
-- Vincent Johns <vjohns@xxxxxxxxxxxxxxxxxx> Please feel free to quote anything I say here.
.
- Follow-Ups:
- Re: do all primary keys use autonumber
- From: peregenem
- Re: do all primary keys use autonumber
- Prev by Date: How to add new fields to linked table in backend MDB using code.
- Next by Date: Re: How to add new fields to linked table in backend MDB using code.
- Previous by thread: How to add new fields to linked table in backend MDB using code.
- Next by thread: Re: do all primary keys use autonumber
- Index(es):
Relevant Pages
|