473,506 Members | 16,951 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Access 2000 - Query HELP!: Why does it not sum credits/negative dollar amounts?

Group By - Client
Sum - PastDue: Iif(DateDiff("d",[InvoiceDate],Date())>30,[InvoiceNetTotal],0)
Sum - Current: Iif(DateDiff("d",[InvoiceDate],Date())<31,[InvoiceNetTotal],0)

These 2 sum fields work fine, EXCEPT it is not summing my negative
numbers/credits. Can not understand why?
Nov 13 '05 #1
1 2328
Kevin,
Sum - PastDue: is the column title, not a formula. Try something like
TotalPastDue:
Iif(DateDiff("d",[InvoiceDate],Date())>30,Sum([InvoiceNetTotal]),0).
Current balance would be similar. Now, I am fishing here, but if you are
writing SQL to do billing and put a total of the past due invoices in one
column and a total of the current invoices in another column and add them up
I'd probably use subqueries to supply my data to my main query. Something
like:
"SELECT PAST_DUE.TOTAL AS PAST_DUE_BALANCE, CURRENT.TOTAL AS CURRENT_BALACE,
PAST_DUE.TOTAL + CURRENT.TOTAL AS TOTAL_DUE
FROM (SELECT INVOICES.INV_NO, SUM(INVOICES.TOTAL) AS TOTAL WHERE
DATEDIFF("D",INVOICEDATE,DATE())>=30 GROUP BY INVOICES.INV_NO) AS PAST_DUE,
(SELECT SUM(INVOICES.TOTAL) AS TOTAL WHERE
DATEDIFF("D",INVOICEDATE,DATE())<30 GROUP BY INVOICES.INV_NO) AS CURRENT
WHERE PAST_DUE.INV_NO = CURRENT.INV_NO"

"Kevin" <ka***@worldnet.att.net> wrote in message
news:8f**************************@posting.google.c om...
Group By - Client
Sum - PastDue:
Iif(DateDiff("d",[InvoiceDate],Date())>30,[InvoiceNetTotal],0)
Sum - Current:
Iif(DateDiff("d",[InvoiceDate],Date())<31,[InvoiceNetTotal],0)

These 2 sum fields work fine, EXCEPT it is not summing my negative
numbers/credits. Can not understand why?

Nov 13 '05 #2

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

Similar topics

24
2693
by: jason | last post by:
Hi Ray...a while ago you explained an elegant solution to enable me to CREATE and EDIT existing tables and queries inside my online access 2000 database.... could you provide refresher links on...
2
1348
by: Kailey11 | last post by:
This probably is a basic question for most of you, but I am setting up an very simple database - person, date traveled, location and milage - using ACCESS 2000 and I want to add up the milage in...
1
3634
by: j.mandala | last post by:
I created a simple link between two tables in a query. TableA has Social Security numbers stored as Long Integer Data. (I imported this table). The Join is between these two fields Table ...
2
1312
by: Louis1 | last post by:
I build a query, and find that when I close, and go back to it later, the query is wrong. For example, if I use 8 fields, it loses the correct field references, and instead has 8 occurrences of...
12
34791
by: Bookreader | last post by:
I tried Googling this but I get a whole lot of replies about running the SQL statement in VB via ADO. All I want to do is run an existing ACCESS 2000 query from VB with no information returned...
13
4427
by: Greg Strong | last post by:
Hello All, Hello All, What are the ToDo's / Gotchas to convert an MDB Access 2K2 database to an Access Project (i.e. ADP) file for the front end using Microsoft SQL Server 2000 Desktop Engine...
2
4416
by: ILCSP | last post by:
Hello, I'm in the process of changing our 'normal' Access 2000 update queries to Update Pass Through Queries. We have a SQL server 2000 database and we're using an Access 2000 database as our...
2
2884
by: ILCSP | last post by:
Hello again, I'm still in the process of changing ms access queries to Pass through queries. We're using a SQL Server 2000 database with an Access 2000 DB as our front end. I trying to convert...
52
9914
by: Neil | last post by:
We are running an Access 2000 MDB with a SQL 7 back end. Our network guy is upgrading to Windows Server 2003 and wants to upgrade Office and SQL Server at the same time. We're moving to SQL Server...
2
3627
by: ILCSP | last post by:
Hello, I have the following query in Access 2000 that I need to convert to SQL 2000: UPDATE tblShoes, tblBoxes SET tblShoes.Laces1 = Null WHERE (((tblShoes.ShoesID)=Int(.)) AND...
0
7218
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7103
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
7370
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7478
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
5614
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5035
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...
0
4701
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3177
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1532
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.