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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

trying to sum a total between 2 dates...

Status
Not open for further replies.

mahaMutant

Programmer
Dec 12, 2001
55
0
0
GB
Form with 2 text boxes and a subform holding records returned from qry_SalesSummary.

I am trying to sum the totals with the following aggregate function, i think the sql string is not quite right:

Forms!frm_SalesSummary_Main!Total = DSum("[Total]", "qry_SalesSum", "[ProccessDate] Between #" & strFromDate & "# And #" & strToDate & "#")

If I enter from the form the date parameters as:
02/02/2002 and 02/03/2002 [in 2 text boxes] i get the records retunrned in a subform OK, but the Total is either empty or inaccurate or it returns the total of the WHOLE query [sum of all the sales].

Please help.. ] always a sucker to the greatest lie of all: will only take a minute [
 
Is there a field/column in the query called Total? This seems to be what you are trying to Sum with your DSum statement. I can see nothing wrong with the DSum Statement but I would like to see the SQL for the query qry_SalesSum.

I noticed in your post that you refer to qry_SalesSummary at the top and then in the Function your refer to qry_SalesSum. Are there two different queries here?

Can you post that code? It would help.

Bob Scriver
 
Since the subform already has the records concerned you only need to Sum the relevant sales in the subform footer. ie.=Sum([Sales])
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top