473,503 Members | 1,687 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

multiple field primary key in Access 2003?

Joe
I have a table with a student id and course id. I would like to make
both fields the primary key since a student can have multiple course
ids but I do not want duplicate records.

How would I go about creating the multiple field PK in Access 2003?
Thanks!

Nov 13 '05 #1
1 14024
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Easiest:

1) Open the table in design view.
2) Drag over the record selectors (square blocks to the left of the
column name) of the 2 columns you want as PKs; or, hold down Ctrl &
click the record selectors of the columns you want as PKs.
3) On the main menu click Edit > Primary Key.
4) Close & Save the table.
a) If there is duplicate data in the PK columns you will not be able
to save the new table design.

SQL DDL:

ALTER TABLE table_name
ADD CONSTRAINT PK_table_name (StudentID, CourseID)

Put the above in a Query's SQL view & run it. Number 4), above,
applies: the DDL statement will fail.

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQfHGNYechKqOuFEgEQJ8VgCbB/eeBdagCUjEQG/jR+J1snlAwQIAoPt7
cd/TKbAKgkv7dM4eREPoNy75
=ygN8
-----END PGP SIGNATURE-----
Joe wrote:
I have a table with a student id and course id. I would like to make
both fields the primary key since a student can have multiple course
ids but I do not want duplicate records.

How would I go about creating the multiple field PK in Access 2003?
Thanks!

Nov 13 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
10637
by: suzanne shelton | last post by:
Help! I have two tables that i am wishing to join that involve a multiple field primary key on the primary table. Primary table: ScheduleHistory SID *PK Schedule *PK Secondary...
1
3338
by: poohnie08 | last post by:
i have a excel spreadsheet showing staff name, date,work hour, ot hour, slot1, slot2, slot3, slot4 and others). The "()" will keep repeating from day 1 until end of month. eg in excel spreadsheet,...
5
1460
by: Baldy | last post by:
Hi all, just came across a reall tricky one, perhaps some smart cookie out there can help. I'm querying patient data from our hospital it might look like this UR Date ...
13
6753
by: ricky.agrawal | last post by:
I'm really not sure how to go about this in Access. What I've created is a table for each location. Those tables are identical in format but different in information. The tables are named after...
5
4081
by: rdemyan via AccessMonster.com | last post by:
I have a need to add another field to all of my tables (over 150). Not data, but an actual field. Can I code this somehow. So the code presumabley would loop through all the tables, open each...
6
5998
by: Otis492 | last post by:
Hello, I have been struggling with this for a while. I am working on a rather simple database for claims in Access 2003. I have a table called claims that has a primary key field called Claim #. ...
3
3232
by: Skeeter66 | last post by:
I'm using Access 2003 SP3. I know very little about VB code, but inherited a database with some code and modules already running. I have a new table with a material number and date as the primary...
3
3555
by: davenumber40 | last post by:
I’m creating a small database in Access 2003(XP) to track issues during software testing. As far as databases go, it’s going to be a relatively small, short term project (No more than 20,000 records...
1
3860
realayumi
by: realayumi | last post by:
ACCESS 2003 WIN XP Hi, i'm new in access, just a view days, this is my first post. Sorry for my bad English. I have 3 tables. tbl_product
0
7202
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7332
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6991
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5578
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5014
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3154
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1512
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
736
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
382
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.