Full Version: Help request on a query I'm having a problem with
UtterAccess Discussion Forums > Microsoft® Access > Access Queries
pappyb
Good morning,
I'm having a problem building a query on a type I've not worked before. Here's the situation.

I have a field (we'll call this a FEE) within a table that contains multiple fees for a given loan number. I have another field (we'll call this a REMAINING AMOUNT) that contains an amount that I can use to remove those fee's. What I'm trying to figure out is how I can subtract each FEE from the REMAINING AMOUNT.

Normally if this was a constant 2 fee's I would know how to do this. However, there can be any number of fee's. I would like to avoid having to recreate a bunch of queries to eliminate the fee's. After I remove all of the fee's any remaining sum needs to extract from other amounts (in different tables). Is there an efficient way to do this? I'm rather stuck right now.

Any help would be greatly appreciated

Data Example

LOAN FEE REMAINING AMOUNT
1234 30.22 100.00
1234 34.22 100.00
1234 18.54 100.00
1234 10.22 100.00
1239 05.22 100.00
1239 08.12 100.00
ScottGem
Yes there is, it involves NOT storing calculated values which is generally a nono. The correct way to keep a balance is to use a transactions table that lists each transaction as either a credit or a debit. Then add all the credits and subtract all the debits.
pappyb
Thanks for your reply Scott. I should have been more clear. Each fee has a code. Depending on if that fee is wiped out, I need to know those codes as they are being loaded into a different system. So if I can't wipe out all of the fee's I need to know which fee's were 0'd out. I hope I'm making sense with what I'm saying.
ScottGem
I don't follow. Are you trying to debit the fees from a balance or determine whihc fees have not been charged?
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.