Dsum doesn't returns blank values

  • Thread starter Thread starter yuval
  • Start date Start date
Y

yuval

Dear anyone,

I try to use Dsum function to total the amount of order per each
product.

I have "invoice details" table and "products" table where I want to
update a field to be the total amount of orders per product.

I write
DSum("[amount]","invoice details","[product id]= " & " ' " & [product
id] & " ' ")

but I get blank values.

Can anyone help, I'll certainly appricate it.

Yuval
 
I would try adding brackets around the table name AND eliminating the spaces
you've shown in the quote space apostrophe space quote strings. I prefer to use
Chr(34) to add in quotation marks in my strings.

DSum("[amount]",
"[invoice details]",
"[product id]=" & Chr(34) & [product id] & Chr(34))

if Product Id is not a text field but is a numeric field then drop the "&
Chr(34)" strings from the DSUM. By the way, that DSum should all be on one
line, but for ease of viewing I entered it on three lines.

It is usually NOT a good idea to STORE this kind of calculated data in a table.
It is generally better to calculate it when it is needed using either the DSUM
function or a totals query.
 
Back
Top