Re: Aging Invoice Report



Hi John,

Thanks for your help. There are no suspicious items in the query. It is a
standalone query, (i.e not in a form) so I am not sorting by anything. And I
still have the error that pops up.

And yes, I do have a payments table that has PaymentID (primary key) ,
AcctNumber, PaymentAmount, PaymentDate, PaymentMethodID (which links to
another table that has check, cash, or credit card). I hope this clears up
some things

John Spencer wrote:
"d" is the argument that tells DateDiff to calculate the number of Days and
not the number of months (m), Hours(h), Years(yyyy), etc.

SELECT tblOrders.AcctNumber
, tblOrders.ItemNumber
, tblOrders.InvoiceDate
, IIf (DateDiff("d",InvoiceDate,Date())<=30,InvoiceAmount,0) AS [0-30]
, IIf(DateDiff("d",InvoiceDate,Date())>30 And
DateDiff("d",InvoiceDate,Date())<=60,InvoiceAmount,0) AS [31-60]
, IIf(DateDiff("d",InvoiceDate,Date())>60 And
DateDiff("d",InvoiceDate,Date())<=90,InvoiceAmount,0) AS [61-90]
, IIf(DateDiff("d",InvoiceDate,Date())>90,InvoiceAmount,0) AS [91+]
FROM (tblCustomers INNER JOIN Payments
ON tblCustomers.AcctNumber=Payments.AcctNumber)
INNER JOIN tblOrders
ON tblCustomers.AcctNumber=tblOrders.AcctNumber;

As a guess, you had the fields customername and customeraddress in you query
at one time and filtered or sorted by them. Check the properties of the
query. If that doesn't fix it, check the properties of the form or report
that is using the query.

How do you know what has an unpaid balance? Do you have a payment field in
this table or do you have a payments table or ????

Hello,

[quoted text clipped - 33 lines]

Thank you!

--
Message posted via http://www.accessmonster.com

.