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

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

Post by weircoli » Sat, 12 Aug 2006 23:11:37


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
 
 
 

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

Post by Jeff » Sat, 12 Aug 2006 23:33:31

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!

 
 
 

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

Post by weircoli » Sat, 12 Aug 2006 23:54:51

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
 
 
 

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

Post by Jeff » Sun, 13 Aug 2006 00:32:04

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.
 
 
 

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

Post by weircoli » Tue, 15 Aug 2006 17:50:13

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
 
 
 

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

Post by weircoli » Tue, 15 Aug 2006 23:06:08

i

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

Thanks for all your help, much appreciated.

Colin
XXXX@XXXXX.COM wrote: