PC Review


Reply
Thread Tools Rate Thread

Current and Past Balances

 
 
=?Utf-8?B?VW5kZXJwYWlkYWRtaW4=?=
Guest
Posts: n/a
 
      28th Feb 2006
I am trying to make a query that generates a current balance on a record
using the date of an initial balance and the dates of payments made. This
way I can always make a query to get a balance from the past. So far I have
2 queries that almost do what I want:

Query Name: qryPaymentAmountSum
SELECT Sum(tblPaymentslst.PaymentAmount) AS [Total Paid],
tblPaymentslst.CaseNum
FROM tblPaymentslst
GROUP BY tblPaymentslst.CaseNum;

Query Name: qryCurrentBalance
SELECT tblBalances.CaseNum, tblBalances!InitBal-qryPaymentAmountSum![Total
Paid] AS CurBalqry
FROM qryPaymentAmountSum RIGHT JOIN tblBalances ON
qryPaymentAmountSum.CaseNum = tblBalances.CaseNum
GROUP BY tblBalances.CaseNum, tblBalances!InitBal-qryPaymentAmountSum![Total
Paid];

This almost does what I want except it if the case does not have any
payments the current balance is blank when it should actually be equal to the
initial balance.

If this is not enough to get the idea they please say so.
 
Reply With Quote
 
 
 
 
jleckrone@hotmail.com
Guest
Posts: n/a
 
      28th Feb 2006
When you run your equation in your second query, it evaluates it as
InitBal - NULL and that's why you are getting a Null (blank) result.
Try this in place of your equation:
iif(isNull(TotalPaid), InitBal, InitBal - TotalPaid)

 
Reply With Quote
 
=?Utf-8?B?VW5kZXJwYWlkYWRtaW4=?=
Guest
Posts: n/a
 
      1st Mar 2006
Perfect! Thank you so much! Didn't know how to use IF statements in queries.

"(E-Mail Removed)" wrote:

> When you run your equation in your second query, it evaluates it as
> InitBal - NULL and that's why you are getting a Null (blank) result.
> Try this in place of your equation:
> iif(isNull(TotalPaid), InitBal, InitBal - TotalPaid)
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Concerning Current Date Changes On Past Documents =?Utf-8?B?c21hcnRhc2llbg==?= Microsoft Word Document Management 2 2nd May 2006 03:31 PM
Change Past System Tray Past Item to Current Item rijj@bluefrog.com Windows XP General 1 14th Nov 2005 04:22 PM
Notification Icons - Current and Past =?Utf-8?B?am9obmRvd251bmRlcg==?= Windows XP Customization 5 7th Apr 2005 08:57 AM
How to link endings balances to beginning balances on different sh =?Utf-8?B?anVkeXNraXNrZA==?= Microsoft Excel Worksheet Functions 1 28th Oct 2004 07:21 PM
Task - Displaying only current and Past J Ramsey Microsoft Outlook 0 9th Jul 2004 05:43 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:46 AM.