473,407 Members | 2,359 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

Running Total Query SQL Syntax Error

I am scratching my head with the required quotes and parentheses.
I started with an existing working Query with Running Total
by date.

Now I need to produce a running total by quarter day, so I converted my
dates in serial increments of 6 hours intervals.
I verified that these serial dates have the expected values.

I run into repeated syntax error in the adapted Query.

'Original working Query taken as sample, where dates are in Date type.

SELECT master2.WBS AS WBSAlias, master2.[Pricing Date] AS DateAlias,
Sum(master2.amount) AS [Weekly Amount],

Val(DSum("[amount]","master2","[WBS]= '" & [WBSAlias] & "' And
[Pricing Date]<= #" & [dateAlias] & "#")) AS [Running Sum]

FROM master2
GROUP BY master2.WBS, master2.[Pricing Date]
ORDER BY master2.WBS, master2.[Pricing Date];
'New Query adapted from previous. Now dates are Serial values.
'Syntax error in string in Query expression. Probable cause : Quotes &
Parentheses around GDate ?

SELECT Sc8T.HTRPhase AS WBSAlias, Sc8T.GDate AS DateAlias,
Sum(Sc8T.QAC) AS Amount,
Val(DSum("[QAC]","Sc8T","[HTRPhase]= '" & [WBSAlias] & "' And [GDate]<=
[dateAlias])) AS [Running Sum]
FROM Sc8T
GROUP BY Sc8T.HTRPhase, Sc8T.GDate
ORDER BY Sc8T.HTRPhase, Sc8T.GDate;

Help would be very much appreciated,
Thank you.
J.P.

Nov 13 '05 #1
1 3209
Are you surrounding the value of WSBAlias with single quotes because it is a
text Field? What type of field is DateAlias? Is it absolutely necessary to
keep the Running Sum in the Query? If not, it is dead easy to specify
Running Sum on a Control in a Report when you are presenting the data.

Larry Linson
Microsoft Access MVP
"u473" <u4**@aol.com> wrote in message
news:11**********************@g44g2000cwa.googlegr oups.com...
I am scratching my head with the required quotes and parentheses.
I started with an existing working Query with Running Total
by date.

Now I need to produce a running total by quarter day, so I converted my
dates in serial increments of 6 hours intervals.
I verified that these serial dates have the expected values.

I run into repeated syntax error in the adapted Query.

'Original working Query taken as sample, where dates are in Date type.

SELECT master2.WBS AS WBSAlias, master2.[Pricing Date] AS DateAlias,
Sum(master2.amount) AS [Weekly Amount],

Val(DSum("[amount]","master2","[WBS]= '" & [WBSAlias] & "' And
[Pricing Date]<= #" & [dateAlias] & "#")) AS [Running Sum]

FROM master2
GROUP BY master2.WBS, master2.[Pricing Date]
ORDER BY master2.WBS, master2.[Pricing Date];
'New Query adapted from previous. Now dates are Serial values.
'Syntax error in string in Query expression. Probable cause : Quotes &
Parentheses around GDate ?

SELECT Sc8T.HTRPhase AS WBSAlias, Sc8T.GDate AS DateAlias,
Sum(Sc8T.QAC) AS Amount,
Val(DSum("[QAC]","Sc8T","[HTRPhase]= '" & [WBSAlias] & "' And [GDate]<=
[dateAlias])) AS [Running Sum]
FROM Sc8T
GROUP BY Sc8T.HTRPhase, Sc8T.GDate
ORDER BY Sc8T.HTRPhase, Sc8T.GDate;

Help would be very much appreciated,
Thank you.
J.P.

Nov 13 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Peter Bailey | last post by:
I have a query that creates a graph of bookings from the course start date looking back 20 weeks based on a running sum. I also have a query that counts the number of bookings before that 20 week...
5
by: James Conrad StJohn Foreman | last post by:
Have found http://www-128.ibm.com/developerworks/db2/library/techarticle/lyle/0110lyle.html which is quite helpful, but doesn't quite tell me what I want. I have a table, advertising_spend with...
16
by: Gandalf186 | last post by:
I need to create a query that produces running totals for every group within my table for example i wish to see: - Group A 1 5 9 15 Group B
2
by: Jana | last post by:
Using Access 97. Background: I have a main report called rptTrustHeader with a subreport rptTrustDetails in the Details section of the main report. The main report is grouped by MasterClientID. ...
6
by: Zairay | last post by:
Hi All, I have a problem with running a query. Str = "SELECT Biographies.BID, Biographies.family_name AS , " & _ "Biographies.first_name AS , Biographies.sonof AS , " & _...
5
by: mebrabham | last post by:
Hello, I am trying to create a running subtotal in a query and then graph the running subtotal for each city group. The data looks like this in the table (for illustration): My City My...
9
by: JJM0926 | last post by:
I'm trying to create a running totals query in access 97. I have followed the directions on how to do it from Microsofts website article id 138911. I took their code they had and replaced it with...
4
by: dougans | last post by:
Hey there people, Need help on this one if you can spare me a second!!! No idea why, been trying for 2 hours to fix this now and I feel like a complete loser haha. Anyone have any idea why...
6
by: sstidham | last post by:
I have a query which calculates the data from two table and then yields the number of points based on various calculations for each category. Essentially we are trying to rank our Agents based on...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.