Dsum Wont work

John thomas

Registered User.
Local time
Today, 09:02
Joined
Sep 4, 2012
Messages
206
I am trying to use Dsum in a report
Nothing happens
It is based on info from a table that is a subform could this be the problem .It seems to me it does not recognize the table name .I have checked everything over time and time again .I have tried all different senarios but nothing
All help gratefully accepted
 
Hmm, could you please post the SQL so we could have a look.

Also, I am assuming the subform is open when you run the report so we're going to need the name of the main form and the subform... just to peek at the syntax.
 
Hi Gina Thanks for getting back
I don't know how to get the sql.But this what I have typed into a text box That I dropped onto my report
=Dsum("SoldAtPrice","[Order Details","IDOrd=255")
The soldatprice is a currency field in the order details table which is a sub form of the neworders table . I have given every record a value OF £0.1
 
=Dsum("SoldAtPrice","[Order Details","IDOrd=255")

you have a "[" in your table name.
 
With the space in the name you need brackets and paranthesis on both sides. So, is this a typo?

Code:
=Dsum("SoldAtPrice","[Order Details","IDOrd=255")

Or, does yours look like...
Code:
=DSum("SoldAtPrice","[Order Details]","IDOrd=255")

You are also asking for DSum on a specifice IDOrd. Is that a PK or FK?
 
Thanks for your help ..Sorry it was my Typo I do have had a square bracket at the end of the table name as in your seco nd example and the idord is a fk
does the fact that this is a subform make any odds
 
Hmm, what are you trying to Sum? Because the way it is means it
s only summing what IDOrd equals 255 and nothing else.
 
Hi Gina
Im Trying to add up all the soldAtPrice Fields for the various order lines for the order 255
For eg the order 255 has 3 order items with a sold at price .Iwant to add up the total of order 255
 
Okay then is *Order Details* your Table/Query and is SoldAtPrice a Field in the Table/Query?
 
I have tried various places, above the details section and in the footer section It is currently in the section above the details section But niether .Does it being a sub form have any bearing
 

Users who are viewing this thread

Back
Top Bottom