DSum Funktion isn`t working

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]);
 
K

Ken Snell [MVP]

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]);
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

DSum criteria 1
subquery expression HELP! 1
Running Totals in a query Microsoft article 290136 2
Running total in query 2
Running Total 10
DSUM, Running total problem 8
Dailly Running Totals 6
Zdouble Problem 1

Top