472,328 Members | 1,716 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

Using SUM and GROUP problems

Here is what I need I am running a report the report shows all the invoices between two dates and total all the subtotals of the invoices and the taxes on the invoices. Here is the code.

strSQL= "SELECT Sum(tblinvoices.fldsubtotal) As fldsubtotal, Sum(tblinvoices.fldpst) As fldpst, tblinvoices.flddate FROM tblinvoices GROUP BY tblinvoices.flddate HAVING tblinvoices.flddate BETWEEN #" & strStartDate & "# AND #" & strEndDate & "#"

But it only gives me one of the invoices the GROUP BY makes a mess of it but I need the date as it is part of the record filter. The SUM works but I can't get the right totals without the date.
Aug 13 '07 #1
4 1239
jhardman
3,406 Expert 2GB
You could try this simplified query:
Expand|Select|Wrap|Line Numbers
  1. strSQL= "SELECT * FROM tblinvoices WHERE tblinvoices.flddate BETWEEN #" & strStartDate & "# AND #" & strEndDate & "#"
and find the sum with asp. Let me know if this helps.

Jared
Aug 14 '07 #2
How would I find the sum with ASP?
Aug 18 '07 #3
Never mind, I got it. I was thinking that if I SUM the date then system can not use the BETWEEN to filter the records but I was wrong so I used SUM on each of the SQL items and IT WORKS!!
Aug 18 '07 #4
jhardman
3,406 Expert 2GB
Never mind, I got it. I was thinking that if I SUM the date then system can not use the BETWEEN to filter the records but I was wrong so I used SUM on each of the SQL items and IT WORKS!!
I'm glad you got it to work. Thanks for posting your solution.

Jared
Aug 18 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Ken Kolda | last post by:
I have a .NET assembly which utilizes the System.Management classes to retrieve information about the computer. When run under ASP.NET, I can use...
4
by: August1 | last post by:
A handful of articles have been posted requesting information on how to use these functions in addition to the time() function as the seed to...
13
by: Jalal | last post by:
I am trying to use numeric_limits<double>::min() in an MFC application in Microsoft Visual C++.NET 2003. I am having some difficulties here. The...
13
by: Stumped and Confused | last post by:
Hello, I really, really, need some help here - I've spent hours trying to find a solution. In a nutshell, I'm trying to have a user input a...
19
by: James Fortune | last post by:
I have a lot of respect for David Fenton and Allen Browne, but I don't understand why people who know how to write code to completely replace a...
4
by: James | last post by:
I have a VB windows forms application that accesses a Microsoft Access database that has been secured using user-level security. The application...
1
by: James | last post by:
I have a VB windows forms application that accesses a Microsoft Access database that has been secured using user-level security. The application...
3
by: Igor Kryltsov | last post by:
Hi,I am using slightly modified example posted by Doug Younger and answered by Tom Lane...
6
by: Paul Wagstaff | last post by:
Hi all... I'm passing the value of txtSurname to a function, which returns the correct 'Team' to txtTeam depending on the 'alphabetic' value of...
8
by: Chris Noble | last post by:
I need to check whether a particular user is already a member of an Active Directory Security Group. The following code extract works but only if...
0
by: tammygombez | last post by:
Hey everyone! I've been researching gaming laptops lately, and I must say, they can get pretty expensive. However, I've come across some great...
0
by: concettolabs | last post by:
In today's business world, businesses are increasingly turning to PowerApps to develop custom business applications. PowerApps is a powerful tool...
0
better678
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
0
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
0
by: CD Tom | last post by:
This happens in runtime 2013 and 2016. When a report is run and then closed a toolbar shows up and the only way to get it to go away is to right...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
1
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...

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.