473,320 Members | 1,884 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,320 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 1269
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 this assembly with no problems. But now I'm trying...
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 generate unique groups (sets) of numbers - each group...
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 following are the parts of a simple program I wrote...
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 value in form's textfield. The value should then be...
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 front end do not write something that will automate...
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 is being deployed using No-Touch deployment. The...
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 is being deployed using No-Touch deployment. The...
3
by: Igor Kryltsov | last post by:
Hi,I am using slightly modified example posted by Doug Younger and answered by Tom Lane :)(http://archives.postgresql.org/pgsql-sql/1999-08/msg00159.php) I have the following 2 tables: Table...
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 txtSurname e.g. All surname names between: A*...
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 the user distinguished name is exactly the same...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.