## Calculation problem.

## Calculation problem.

(OP)

Morning Guys,

I have am quite new to this so please bear with me!

I have been racking my brain but i cant figure this out!

I have 5 fields: MoneyIn, Debt, TechLoan, OutstandingDebt, OutstandingTech.

Debt and Techloan do not change from their original value.

So for example the debt = 5000, techloan = 5000 and money in = 8000 (which I input). I want to subtract the debt from the money in and then populate Outstanding debt with 0 then carry over the remaining debt to subtract from Techloan and populate OutstandingTech with 3000.

So what i am trying to do is if the money in clears debt 1 carry over to debt 2 and clear as much of that as possible.

I have been attempting this for days now and i am not getting anywhere. Could some suggest a way i could do this? Or some guidence where to start!

Any help will be fantastic!

Cheers

Mike

I have am quite new to this so please bear with me!

I have been racking my brain but i cant figure this out!

I have 5 fields: MoneyIn, Debt, TechLoan, OutstandingDebt, OutstandingTech.

Debt and Techloan do not change from their original value.

So for example the debt = 5000, techloan = 5000 and money in = 8000 (which I input). I want to subtract the debt from the money in and then populate Outstanding debt with 0 then carry over the remaining debt to subtract from Techloan and populate OutstandingTech with 3000.

So what i am trying to do is if the money in clears debt 1 carry over to debt 2 and clear as much of that as possible.

I have been attempting this for days now and i am not getting anywhere. Could some suggest a way i could do this? Or some guidence where to start!

Any help will be fantastic!

Cheers

Mike

## RE: Calculation problem.

Accourding to the above...

debt = 5000

techloan = 5000

moneyIn = 8000

OutstandingTech = moneyIn - debt

OutstandingDebt = 0

Also please clarify... "So what i am trying to do is if the money in clears debt 1 carry over to debt 2 and clear as much of that as possible."

Simi

## RE: Calculation problem.

Thanks for the reply.

I am trying to do this on a form which is bound to a query/table.

I want to type in the debt, techloand and money in. Click a command button and the calculation occurs.

So in the above example I type 8000 in the MoneyIn field, the techloan and the debt I have previously updated. I click the command button this then performs the following:

Debt (5000) - MoneyIn(8000) = -3000 because the amount in is greater than debt then the 3000 is carried over to the techloan. But because the amount in was greater than the debt, the debt is now 0 so this needs to then update the OutstandingDebt field.

TechLoan (5000) - Remainder (3000) = OutstandingTech (2000)

So the fields can never be negative, if the money in is greater than the debt then the remainder of debt - moneyin is used in techloan - money in.

Is this enough info? Thanks for any help you can give me.

Cheers

Mike

## RE: Calculation problem.

then I guess you have a table of values you need to apply this to?

Or are you just wanting to plug in random ammounts and hit a button to get a total? (Unbound)

Either way it will similar.

Setup your fields on the form.

Create a button. Right click the button and choose Build Event. Then choose Build Code.

Then just build the build your code.

if Debt - MoneyIn > 0 then

techloan=Debt - MoneyIn

Else

OutstandingDebt = Debt - MoneyIn

endif

This is just psudo code but there are plent of examples on the web to help you out.

Simi