Macro to pull all

C

Chantel33

I would like to create a form to enter required data to produce a
questionnaire. In this form I would like for the user to be able to click or
select a button and that button pull all
Questions related to that particular condition. I have a joined table in a
query where the have relationship but I am only able to pull one at a time.
Is it possible to select the condition once by a click of a button and pull
all questions onto the report?
 
S

Steve Schapel

Chantel,

Sorry, I think you may need to provide some more detailed information here,
before anyone can answer your question.

I do not understand what "pull" a question means. And what is a
"condition"? You have mentioned a form, and a report, but it is not clear
whether you mean a form, or a report, or both, and what is the relationship
between them?

Also, maybe it would help if you gave the names of your tables, and showed
us what fields you have, and give some examples of the data, and say what
you actually want to happen when you click the button.

Thanks.
 
C

Chantel33

Steve

I apologize i am still new and sometimes find it hard to present my question
correctly on the board but here is a second try.

I do have ywo tables :

tbl Questions
Question ID
Question Text
Condition ID to the table

tbl Conditions
Condition name
condition ID

when i mentioned "joined table" i should have state referential integrity


I need a report – to produce the draft of the questionnaire

On my form I have a combo box with the conditions listed
Once I select the condition and it stores in the table, I would like to
produce
A Report -“Questionnaire†with all question associated with that one
condition.

Example: So if I select Asthma and there are 4 questions related to Asthma,
I want all 4 questions to populate on my Report - “Questionnaireâ€
 
S

Steve Schapel

Chantel,

Thanks for the further information. Now I understand.

The easiest way to do this is base your report on a query that uses the
Questions table, and then in the Criteria of the Condition ID field in the
query, enter the equivalent of this:
[Forms]![NameOfYourForm]![NameOfTheConditionsCombobox]

Make sure the Bound Column property of the combobox is set up to point to
the Condition ID.
 
C

Chantel33

Steve

I have created a query:
query 1 based on the questions table
i have entered : [Forms]![Mail Merge]![Questionnaire]

but when i attempt to run the query i get a message to enter the parameter
value

the combo box is bound and pointing to the condition ID

Steve Schapel said:
Chantel,

Thanks for the further information. Now I understand.

The easiest way to do this is base your report on a query that uses the
Questions table, and then in the Criteria of the Condition ID field in the
query, enter the equivalent of this:
[Forms]![NameOfYourForm]![NameOfTheConditionsCombobox]

Make sure the Bound Column property of the combobox is set up to point to
the Condition ID.

--
Steve Schapel, Microsoft Access MVP


Chantel33 said:
Steve

I apologize i am still new and sometimes find it hard to present my
question
correctly on the board but here is a second try.

I do have ywo tables :

tbl Questions
Question ID
Question Text
Condition ID to the table

tbl Conditions
Condition name
condition ID

when i mentioned "joined table" i should have state referential integrity


I need a report – to produce the draft of the questionnaire

On my form I have a combo box with the conditions listed
Once I select the condition and it stores in the table, I would like to
produce
A Report -“Questionnaire†with all question associated with that one
condition.

Example: So if I select Asthma and there are 4 questions related to
Asthma,
I want all 4 questions to populate on my Report - “Questionnaireâ€


.
 
S

Steve Schapel

Chantel,

Where did you enter the [Forms]![Mail Merge]![Questionnaire] in your query?
Is "Questionnaire" the name of the combobox?

--
Steve Schapel, Microsoft Access MVP


Chantel33 said:
Steve

I have created a query:
query 1 based on the questions table
i have entered : [Forms]![Mail Merge]![Questionnaire]

but when i attempt to run the query i get a message to enter the parameter
value

the combo box is bound and pointing to the condition ID

Steve Schapel said:
Chantel,

Thanks for the further information. Now I understand.

The easiest way to do this is base your report on a query that uses the
Questions table, and then in the Criteria of the Condition ID field in
the
query, enter the equivalent of this:
[Forms]![NameOfYourForm]![NameOfTheConditionsCombobox]

Make sure the Bound Column property of the combobox is set up to point to
the Condition ID.

--
Steve Schapel, Microsoft Access MVP


Chantel33 said:
Steve

I apologize i am still new and sometimes find it hard to present my
question
correctly on the board but here is a second try.

I do have ywo tables :

tbl Questions
Question ID
Question Text
Condition ID to the table

tbl Conditions
Condition name
condition ID

when i mentioned "joined table" i should have state referential
integrity


I need a report – to produce the draft of the questionnaire

On my form I have a combo box with the conditions listed
Once I select the condition and it stores in the table, I would like to
produce
A Report -“Questionnaire†with all question associated with that one
condition.

Example: So if I select Asthma and there are 4 questions related to
Asthma,
I want all 4 questions to populate on my Report - “Questionnaireâ€


.
 
C

Chantel33

in the Criteria of the Condition ID field
Yes the name of the combobox is Questionnaire

Steve Schapel said:
Chantel,

Where did you enter the [Forms]![Mail Merge]![Questionnaire] in your query?
Is "Questionnaire" the name of the combobox?

--
Steve Schapel, Microsoft Access MVP


Chantel33 said:
Steve

I have created a query:
query 1 based on the questions table
i have entered : [Forms]![Mail Merge]![Questionnaire]

but when i attempt to run the query i get a message to enter the parameter
value

the combo box is bound and pointing to the condition ID

Steve Schapel said:
Chantel,

Thanks for the further information. Now I understand.

The easiest way to do this is base your report on a query that uses the
Questions table, and then in the Criteria of the Condition ID field in
the
query, enter the equivalent of this:
[Forms]![NameOfYourForm]![NameOfTheConditionsCombobox]

Make sure the Bound Column property of the combobox is set up to point to
the Condition ID.

--
Steve Schapel, Microsoft Access MVP


Steve

I apologize i am still new and sometimes find it hard to present my
question
correctly on the board but here is a second try.

I do have ywo tables :

tbl Questions
Question ID
Question Text
Condition ID to the table

tbl Conditions
Condition name
condition ID

when i mentioned "joined table" i should have state referential
integrity


I need a report – to produce the draft of the questionnaire

On my form I have a combo box with the conditions listed
Once I select the condition and it stores in the table, I would like to
produce
A Report -“Questionnaire†with all question associated with that one
condition.

Example: So if I select Asthma and there are 4 questions related to
Asthma,
I want all 4 questions to populate on my Report - “Questionnaireâ€



.
.
 
S

Steve Schapel

Chantel,

I can't immeditately see the cause of the problem here. It seems like you
have done it right. If you are getting a 'Enter paramater value' prompt,
which I presume is asking you for the value of 'Questionnaire', it means
that Access can't find it. For which the most common cause would be that it
is spelled incorrectly, or some such, so can you carefully recheck the
details please.

If still not working, can you please copy/paste the SQL view of the query
into your reply here... just may give a clue.

--
Steve Schapel, Microsoft Access MVP


Chantel33 said:
in the Criteria of the Condition ID field
Yes the name of the combobox is Questionnaire

Steve Schapel said:
Chantel,

Where did you enter the [Forms]![Mail Merge]![Questionnaire] in your
query?
Is "Questionnaire" the name of the combobox?
 
C

Chantel33

SELECT Questions.Question, Questions.[Condition ID]
FROM Questions
WHERE (((Questions.[Condition ID])=[Forms]![Mail Merge]![Questionnaire]));


Steve Schapel said:
Chantel,

I can't immeditately see the cause of the problem here. It seems like you
have done it right. If you are getting a 'Enter paramater value' prompt,
which I presume is asking you for the value of 'Questionnaire', it means
that Access can't find it. For which the most common cause would be that it
is spelled incorrectly, or some such, so can you carefully recheck the
details please.

If still not working, can you please copy/paste the SQL view of the query
into your reply here... just may give a clue.

--
Steve Schapel, Microsoft Access MVP


Chantel33 said:
in the Criteria of the Condition ID field
Yes the name of the combobox is Questionnaire

Steve Schapel said:
Chantel,

Where did you enter the [Forms]![Mail Merge]![Questionnaire] in your
query?
Is "Questionnaire" the name of the combobox?


.
 
S

Steve Schapel

Chantel,

You haven't told us at this stage what the parameter prompt is asking for.

I have noticed that you have this in your query:
Questions.Question
.... whereas in your earlier post you did not indicate a field named Question
in the Questions table, but you do have a field named Question Text. Could
that be relevant to the problem?

--
Steve Schapel, Microsoft Access MVP


Chantel33 said:
SELECT Questions.Question, Questions.[Condition ID]
FROM Questions
WHERE (((Questions.[Condition ID])=[Forms]![Mail Merge]![Questionnaire]));


Steve Schapel said:
Chantel,

I can't immeditately see the cause of the problem here. It seems like
you
have done it right. If you are getting a 'Enter paramater value' prompt,
which I presume is asking you for the value of 'Questionnaire', it means
that Access can't find it. For which the most common cause would be that
it
is spelled incorrectly, or some such, so can you carefully recheck the
details please.

If still not working, can you please copy/paste the SQL view of the query
into your reply here... just may give a clue.
 

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

Similar Threads


Top