DSum Funktion isn`t working

  • Thread starter Thread starter Benjamin
  • Start date Start date
B

Benjamin

Hi,

i have a little problem with the dsum function in an query.
I have the field Datum with dates in it. Also i got Summe
von Stück as an quantity and PPM relevante
Fehler_Monat_summiert as an quantity, too.Both quantities
are from an temp query. I would like to have an running
sum about the last 12 month on both quantities. i made an
dsum function which is not working very well, to be honest
the function is functional.

can anyone say why this does not work ?

Thanks

Benjamin

SELECT DatePart("yyyy",[Datum_3]) AS AYear, DatePart("m",
[Datum_3]) AS AMonth, DSum("Summe von Stück","PPM
relevante Fehler_Monat_summiert","DatePart('m', [Datum_3])
<=" & [AMonth] & " And DatePart('yyyy',[Datum_3])<=" &
[AYear] & "") AS RunTot
FROM [PPM relevante Fehler_Monat_summiert]
GROUP BY DatePart("yyyy",[Datum_3]), DatePart("m",
[Datum_3])
ORDER BY DatePart("yyyy",[Datum_3]), DatePart("m",
[Datum_3]);
 
You have two " characters at the end of the DSum function's third argument.
Change them to just one " character.

--

Ken Snell
<MS ACCESS MVP>

Hi,

i have a little problem with the dsum function in an query.
I have the field Datum with dates in it. Also i got Summe
von Stück as an quantity and PPM relevante
Fehler_Monat_summiert as an quantity, too.Both quantities
are from an temp query. I would like to have an running
sum about the last 12 month on both quantities. i made an
dsum function which is not working very well, to be honest
the function is functional.

can anyone say why this does not work ?

Thanks

Benjamin

SELECT DatePart("yyyy",[Datum_3]) AS AYear, DatePart("m",
[Datum_3]) AS AMonth, DSum("Summe von Stück","PPM
relevante Fehler_Monat_summiert","DatePart('m', [Datum_3])
<=" & [AMonth] & " And DatePart('yyyy',[Datum_3])<=" &
[AYear] & "") AS RunTot
FROM [PPM relevante Fehler_Monat_summiert]
GROUP BY DatePart("yyyy",[Datum_3]), DatePart("m",
[Datum_3])
ORDER BY DatePart("yyyy",[Datum_3]), DatePart("m",
[Datum_3]);
 
Back
Top