Help on Dsum

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I have the following SQL statement which I use for calculation some figures:
SELECT , [TBL 1].Product, [TBL 1].Year, [TBL 1].Month, [TBL
1].Value,DSum("Value","TBL 1",[TBL 1].[Product] &" =[Product]") AS Acc_sum
FROM [TBL 1];

Somehow this Statement returns #Error, however when I calculate Dsum on the
year column it works perfectly
SELECT , [TBL 1].Product, [TBL 1].Year, [TBL 1].Month, [TBL
1].Value,DSum("Value","TBL 1",[TBL 1].[year] &" =[year]" & -1) AS Acc_sum
FROM [TBL 1];

How is this possible???

b.t.w. [year] = number and [product] = text.

TIA
 
Since product is text, it must be enclosed in single or double quotes.
"[TBL 1].[Product] ='" & [Product] & "'")

BTW, the quotes are not in the correct place for the other query either.
 
Thanks finally figured it out, how Dsum works ;-).
Again Thanks a lot

Pat Hartman(MVP) said:
Since product is text, it must be enclosed in single or double quotes.
"[TBL 1].[Product] ='" & [Product] & "'")

BTW, the quotes are not in the correct place for the other query either.

Brotha Lee said:
Hi,

I have the following SQL statement which I use for calculation some
figures:
SELECT , [TBL 1].Product, [TBL 1].Year, [TBL 1].Month, [TBL
1].Value,DSum("Value","TBL 1",[TBL 1].[Product] &" =[Product]") AS Acc_sum
FROM [TBL 1];

Somehow this Statement returns #Error, however when I calculate Dsum on
the
year column it works perfectly
SELECT , [TBL 1].Product, [TBL 1].Year, [TBL 1].Month, [TBL
1].Value,DSum("Value","TBL 1",[TBL 1].[year] &" =[year]" & -1) AS Acc_sum
FROM [TBL 1];

How is this possible???

b.t.w. [year] = number and [product] = text.

TIA
 
Back
Top