Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using a query to calulate fields

Status
Not open for further replies.

jwelt

Technical User
Jul 19, 2002
7
0
0
US
HI,
I am trying to make a form that will display the calculated number of floppies used between two dates. I made a query to do this that takes in two dates from the form, and displays all records that are between the two dates (This works so far). Now, I would like to finish the calculation by summing all the floppies in those records and display the final number in a text box. I'm still not certain how to do this, though.

How do I base a calculation on a query?

Should I be setting the form's recordsource property to the query, [Sums]? Because if I do, everything on the form disappears. I have no idea why.

I made a text box whose controlsource was [Sums]![SumOfFloppies] Is that right?

Maybe I should populate a table based on the results of the query and then work with that? But how do I do that?

As you can see, I'm not that adept yet at working with access, so try to keep it simple.
 
In the form header, put a text box with the control source

=Sum([Fieldyouwantsumfor])

You may want to make a field in your query that will always be 1 (For example, in your query put Count:1) That way any record that comes up in the query will have a value of 1. Then run your sum field in your form off of that field.

Hope that helps.

Monkey

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top