Foreign Key <--> Primary Key Dilemma

R

Robert W.

With an MS Access database I'm using SQL to create two tables, Questions and
Choices. Questions is essentially the parent of Choices. I'm creating them
like this:

CREATE TABLE Choices (Question_Num Int, Choice_Num Int, [Text] Memo, Primary
Key (Question_Num, Choice_Num))

CREATE TABLE Questions ([Num] Int Primary Key References Choices
(Question_Num), [Text] Memo, AnswerFormat Char(25))


You'll note that the Primary Key in Choices consists of two fields. This is
because for each Question there will be multiple Choices.

My dilemma comes when I try to create the Reference between Questions and
Choices. I simply want to make a connection between Questions.Num and
Choices.Question_Num but it won't let me because the primary key in Choices
consists of two fields.

What should I do?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top