Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Two Fields as one Primary Key 1

Status
Not open for further replies.

jestrada101

Technical User
Mar 28, 2003
332
How can I make two fields a primary key?
 
Try joining them together as one.
Without anymore info that's the best i can offer.

Regards, Phil

"Then I’d say what’s the point of having rank if you can’t pull it?"

(DCI Jack Meadows)
 
I have a table with two fields:
FieldA
FieldB


How can I make both fields to be considered a primary Key.

e.g. would be allowed
FIELDA FIELDB
------ ------
12 11
12 10

e.g. would not be allowed
FIELDA FIELDB
------ ------
12 11
12 11


Thanks!
JE





 
In the table design, select both fields (using the Shift or Ctrl keys) you want as a key and press the key button. Now you have a composite PK

Leslie
 
If you are still having problems, use the Index window.

Open the table in design mode,

From the main menu, select "View" -> "Indexes".

There are three columns -- Index name, field name and sort order.

- In the Index name, type PrimaryKey
- Select your first field, say "FieldA".
- Set index options to...
Primary: Yes
Unique: Yes
Ignore Nulls: No
- In the next row the, add "FieldB" in the "Feild Name" column. DO NOT enter anything in the Index name column.

Close the window (there is not "save" option) - two keys should show up table design.

Richard
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top