View Full Version : Running Sum in Query Problem


Dumbfounded
11-04-2007, 04:24 AM
Hi Guys,

I'm doing a database for a client and I'm stuck on a graph (or rather having an overall total on the graph). I've done everything in the query but I do need a running sum for this. I've explored my books, looked on the help, checked out various past posts and I seem to be missing something.

I did find a helpful post which solved someone's problem and I have posted the code below. because everytime I try to come out of it (and I've retyped it a number of times) it keeps coming back with "Syntax error in string in query expression blah blah blah".

Code that I have is:-

SELECT Code, QC4RS, PODate, Net,
val(DSum("Net", "Costings Query", "Code"= '" &Code&"' and QC4RS =" & QC4RS & "and PODate <=# "& PODate&"#"))AS RunningSum
FROM [Costings Query];

What I want ultimately is a running sum of the Net Cost for the product code so that it gives me an overall total on the graph. It's now been over 8 hours that I've struggled with this and I'd really appreciate a fresh pair of eyes to tell me what I'm not seeing.

Thanks in advance.

Donna x :mad:

Zigzag
11-04-2007, 04:36 AM
Hi Donna,

How are things?

If you would like me to take a look, send your app across to me and i will see what i can do.

Garry

Zigzag
11-04-2007, 06:59 AM
Bump.

Ive got no answer for this one,
Has anyone else got any experience with graphs who can help.

Garry

Cosmos75
11-10-2007, 08:36 AM
Running Calculations (Total/Sum, Average, Count) in a Query (http://www.accessdb.info/content/view/74/40/)

Rabbie
11-10-2007, 10:50 AM
Hi Guys,
.

I did find a helpful post which solved someone's problem and I have posted the code below. because everytime I try to come out of it (and I've retyped it a number of times) it keeps coming back with "Syntax error in string in query expression blah blah blah".

Code that I have is:-

SELECT Code, QC4RS, PODate, Net,
val(DSum("Net", "Costings Query", "Code"= '" &Code&"' and QC4RS =" & QC4RS & "and PODate <=# "& PODate&"#"))AS RunningSum
FROM [Costings Query];

Donna x :mad:

The condition part of your DSum looks worng. Try this and see if that helps.



val(DSum("Net", "Costings Query", "Code= '" & Code & "' and QC4RS = " & QC4RS & "and PODate <= # "& PODate & "#"))AS RunningSum

Dumbfounded
11-13-2007, 11:34 AM
Thanks for all your help on this guys. I've opted to do two graphs on one page seeing as access doesn't like more than three things on a graph. If anyone can come up with how to do this then please post.

Pivots weren't giving me exactly what I wanted I'm afraid Gaz.

Thanks again for getting me unstuck and making me look for other avenues which all increase my learning in access.

Mwah.