Display totals on a form of selected data/Change query fields from form

W

weircolin

Hi

I am wanting to select information from two combo boxes and then show a
total of how many entries match this criteria.

At the moment to do this I will have to do a series of queries (9
topics each with around 5 sub topics, a lot of queries) to get this
information.

Is there anyway a query field can reference what is in the fields of a
form? Also, even if I were to do this all using seperate queries, how
do I get the form to display the totals?

Cheers

Colin
 
J

Jeff L

Is there anyway a query field can reference what is in the fields of a
form?

Yes. In the criteria of your query field, put
Forms!YourFormName!FormFieldName.

Also, even if I were to do this all using seperate queries, how do I
get the form to display the totals?

You can do this in the query itself or you can have a field on the form
perform the calculation. If you do it in the query, you will need to
use Totals. Click View, Totals. Then in the column you wish to add
up, put Sum in the Totals row for that field. You would then simply
add that field to your form. If you do the calculation on the form
itself, you would make a new textbox and put =Sum([YourFieldName]) in
the control source.

Hope that helps!
 
W

weircolin

Hi

Thanks for the info.

I think I am going wrong somewhere. I am not trying to do the
calculation just yet. I set the criteria as you said and I can see how
it works. (Kicking myself for being so stupid as I've been using the
same thing to perform other things on forms) How would I get the query
to launch showing the selected criteria I have specified on the form?

Thanks

Colin
Jeff said:
Is there anyway a query field can reference what is in the fields of a
form?

Yes. In the criteria of your query field, put
Forms!YourFormName!FormFieldName.

Also, even if I were to do this all using seperate queries, how do I
get the form to display the totals?

You can do this in the query itself or you can have a field on the form
perform the calculation. If you do it in the query, you will need to
use Totals. Click View, Totals. Then in the column you wish to add
up, put Sum in the Totals row for that field. You would then simply
add that field to your form. If you do the calculation on the form
itself, you would make a new textbox and put =Sum([YourFieldName]) in
the control source.

Hope that helps!





Hi

I am wanting to select information from two combo boxes and then show a
total of how many entries match this criteria.

At the moment to do this I will have to do a series of queries (9
topics each with around 5 sub topics, a lot of queries) to get this
information.

Is there anyway a query field can reference what is in the fields of a
form? Also, even if I were to do this all using seperate queries, how
do I get the form to display the totals?

Cheers

Colin
 
J

Jeff L

By "launch", are you just trying to open the query to see the results?
That would be
Docmd.OpenQuery "YourQueryName" You will need to explain a little
better if I missed what you are talking about.

Hi

Thanks for the info.

I think I am going wrong somewhere. I am not trying to do the
calculation just yet. I set the criteria as you said and I can see how
it works. (Kicking myself for being so stupid as I've been using the
same thing to perform other things on forms) How would I get the query
to launch showing the selected criteria I have specified on the form?

Thanks

Colin
Jeff said:
Is there anyway a query field can reference what is in the fields of a
form?

Yes. In the criteria of your query field, put
Forms!YourFormName!FormFieldName.

Also, even if I were to do this all using seperate queries, how do I
get the form to display the totals?

You can do this in the query itself or you can have a field on the form
perform the calculation. If you do it in the query, you will need to
use Totals. Click View, Totals. Then in the column you wish to add
up, put Sum in the Totals row for that field. You would then simply
add that field to your form. If you do the calculation on the form
itself, you would make a new textbox and put =Sum([YourFieldName]) in
the control source.

Hope that helps!





Hi

I am wanting to select information from two combo boxes and then show a
total of how many entries match this criteria.

At the moment to do this I will have to do a series of queries (9
topics each with around 5 sub topics, a lot of queries) to get this
information.

Is there anyway a query field can reference what is in the fields of a
form? Also, even if I were to do this all using seperate queries, how
do I get the form to display the totals?

Cheers

Colin
 
W

weircolin

Hi

Yes, by launch I just want the query to run with the data that I have
selected from the combo boxes on the same form.

I've tried what you have said but it's not showing me any entries on
the query. Has the column heads but no data.

Thanks

Colin
Jeff said:
By "launch", are you just trying to open the query to see the results?
That would be
Docmd.OpenQuery "YourQueryName" You will need to explain a little
better if I missed what you are talking about.

Hi

Thanks for the info.

I think I am going wrong somewhere. I am not trying to do the
calculation just yet. I set the criteria as you said and I can see how
it works. (Kicking myself for being so stupid as I've been using the
same thing to perform other things on forms) How would I get the query
to launch showing the selected criteria I have specified on the form?

Thanks

Colin
Jeff said:
Is there anyway a query field can reference what is in the fields of a
form?

Yes. In the criteria of your query field, put
Forms!YourFormName!FormFieldName.

Also, even if I were to do this all using seperate queries, how do I
get the form to display the totals?

You can do this in the query itself or you can have a field on the form
perform the calculation. If you do it in the query, you will need to
use Totals. Click View, Totals. Then in the column you wish to add
up, put Sum in the Totals row for that field. You would then simply
add that field to your form. If you do the calculation on the form
itself, you would make a new textbox and put =Sum([YourFieldName]) in
the control source.

Hope that helps!





(e-mail address removed) wrote:
Hi

I am wanting to select information from two combo boxes and then show a
total of how many entries match this criteria.

At the moment to do this I will have to do a series of queries (9
topics each with around 5 sub topics, a lot of queries) to get this
information.

Is there anyway a query field can reference what is in the fields of a
form? Also, even if I were to do this all using seperate queries, how
do I get the form to display the totals?

Cheers

Colin
 
W

weircolin

Hi

I've managed to work out what my problem was. Had made a smal mistake.

Thanks for all your help, much appreciated.

Colin
Hi

Yes, by launch I just want the query to run with the data that I have
selected from the combo boxes on the same form.

I've tried what you have said but it's not showing me any entries on
the query. Has the column heads but no data.

Thanks

Colin
Jeff said:
By "launch", are you just trying to open the query to see the results?
That would be
Docmd.OpenQuery "YourQueryName" You will need to explain a little
better if I missed what you are talking about.

Hi

Thanks for the info.

I think I am going wrong somewhere. I am not trying to do the
calculation just yet. I set the criteria as you said and I can see how
it works. (Kicking myself for being so stupid as I've been using the
same thing to perform other things on forms) How would I get the query
to launch showing the selected criteria I have specified on the form?

Thanks

Colin
Jeff L wrote:
Is there anyway a query field can reference what is in the fields of a
form?

Yes. In the criteria of your query field, put
Forms!YourFormName!FormFieldName.

Also, even if I were to do this all using seperate queries, how do I
get the form to display the totals?

You can do this in the query itself or you can have a field on the form
perform the calculation. If you do it in the query, you will need to
use Totals. Click View, Totals. Then in the column you wish to add
up, put Sum in the Totals row for that field. You would then simply
add that field to your form. If you do the calculation on the form
itself, you would make a new textbox and put =Sum([YourFieldName]) in
the control source.

Hope that helps!





(e-mail address removed) wrote:
Hi

I am wanting to select information from two combo boxes and then show a
total of how many entries match this criteria.

At the moment to do this I will have to do a series of queries (9
topics each with around 5 sub topics, a lot of queries) to get this
information.

Is there anyway a query field can reference what is in the fields of a
form? Also, even if I were to do this all using seperate queries, how
do I get the form to display the totals?

Cheers

Colin
 

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