Subform problem

A

Amy Blankenship

Hi, all;

I am working on a database that allows you to enter data that will be used
to power an e.learning course. Some of the pages in the course will have
pages, and some won't. But each question, when it appears, will appear on
only one page for now but may need to be reused in the future. Rather than
having columns for the question-specific information in ALL pages, I have a
separate questions table, and the Page table is related to it by the
QuestionID. So in other words, some pages will have a null questionID if
there is no question, and some will have a questionID.

I have a page form set up with a Question subform. I was hoping that when I
changed to a new, blank page and created a new question, it would create a
new question and automatically assign its QuestionID to the page field.
However, what happened was that on the first page, it created a record with
a QuestionID of 0(!). On subsequent pages, edits on the Question subform
are ignored, and when you return to the page you'll see just the one
question referred to again.

When I created the subform, I was prompted to define the exact relationship
between the tables, since it was parent to child rather than child to
parent, but whatever I did apparently didn't tell Access exactly what I
wanted from the form>subform relationship.

What should I do to help Access figure out that it should create a new
question when I fill in a blank question form and assign its ID to the
parent form's QuestionID field?

Thanks;

Amy
 
B

Baz

Amy Blankenship said:
Hi, all;

I am working on a database that allows you to enter data that will be used
to power an e.learning course. Some of the pages in the course will have
pages, and some won't. But each question, when it appears, will appear on
only one page for now but may need to be reused in the future. Rather than
having columns for the question-specific information in ALL pages, I have a
separate questions table, and the Page table is related to it by the
QuestionID. So in other words, some pages will have a null questionID if
there is no question, and some will have a questionID.

I have a page form set up with a Question subform. I was hoping that when I
changed to a new, blank page and created a new question, it would create a
new question and automatically assign its QuestionID to the page field.
However, what happened was that on the first page, it created a record with
a QuestionID of 0(!). On subsequent pages, edits on the Question subform
are ignored, and when you return to the page you'll see just the one
question referred to again.

When I created the subform, I was prompted to define the exact relationship
between the tables, since it was parent to child rather than child to
parent, but whatever I did apparently didn't tell Access exactly what I
wanted from the form>subform relationship.

What should I do to help Access figure out that it should create a new
question when I fill in a blank question form and assign its ID to the
parent form's QuestionID field?

Thanks;

Amy

The form/subform structure is specifically designed to reflect one-many
relationships, you really can't turn it upside down like this.

I would suggest that you have a "question" field on your Page form, as a
combo box or whatever is appropriate to enable a choice of existing
questions, and next to the "question" field you have a "New Question" button
that pops up a form which allows the entry of a new question.
 

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