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

Help with Dsum 1

Status
Not open for further replies.

aageorge

Technical User
Jun 28, 2003
51
US
I have a report based on query. I need to sum the total of one column called Pieces. I tried putting a textbox in the report footer with the following expression in the controlsource Dsum("[Pieces]","[Production Query]"). It gives me an error message. I can't figure out what I am doing wrong.
 
In the ControlSource of the text box in the report footer put the following:

Sum(Me![Pieces])

Me![Pieces] being the control in the Detail Section of the report that you want to sum the value.

Bob Scriver
Want the best answers? See FAQ181-2886
Nobody believes the official spokesman... but everybody trusts an unidentified source.
Author, Bagdad Bob???

 
Bob,

I tried out what you said but it gave me an error. I did some trial and error and found that DSum([Pieces],"Production Query") gives a number but it is not the correct sum. I am kinda stumped with this one.
 
I am sorry it should have looked like this:

Sum([Pieces])

The Me! designation is not necessary and will cause the error you described. After putting this in the Control Source of the control ACCESS should automatically put an equal sign(=) in front of it. If not then put one in.

Bob Scriver
Want the best answers? See FAQ181-2886
Nobody believes the official spokesman... but everybody trusts an unidentified source.
Author, Bagdad Bob???

 
Bob,

That gives an error too. After some more experimenting, I figured out the dsum expression for some reason takes the last piece entry and multiplies it with number of enteries in the report. For eg: it the last entry is 20 and number of rows in the report is 3, it gives out 60. I trying different combinations for the sum function without any luck.
 
Just what is the error you are getting? Be specific. Also, copy and paste the exact code that you are putting in the control in the Report Footer. What is the name of the control in the Detail section that you want to sum its values?

The DSum function should not be used here. The report totallying process works just fine. You just have a get the syntax correct.


Bob Scriver
Want the best answers? See FAQ181-2886
Nobody believes the official spokesman... but everybody trusts an unidentified source.
Author, Bagdad Bob???

 
Bob,

I messed up I was placing the textbox in the page footer and not the report footer. It works fine now. Thanks for the help.
 
That'll do it. Glad that you solved you problem.

Bob Scriver
Want the best answers? See FAQ181-2886
Nobody believes the official spokesman... but everybody trusts an unidentified source.
Author, Bagdad Bob???

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top