Summing values by considering the Yes/No checkboxes. (1 Viewer)

ia04

New member
Local time
Yesterday, 23:18
Joined
Aug 23, 2006
Messages
7
Hi,

i have created a table that would calculate the total payments that are being made by a certain contractor. I am assuming that the contractor pays the money in three installments.

In a table I have created three fields which are all checkboxes that would state whether a payment has been made or not, for example, checkbox1 would state whether the first payment has been made. And I also have three other fields that states the amount to be paid on each installment

Now, i want to calculate the total amount that have been payed. For example, lets say that the first installment has been made (i.e the checkbox is checked), then the first payment should be added. And if the second payment has been made it should be added as well, thus finally giving the total amount that has been made.

I know how the logic should look like, but i just don't know the syntax that i should use in the query.

Thanks.
 

Matt Greatorex

Registered User.
Local time
Today, 02:18
Joined
Jun 22, 2005
Messages
1,019
total_amount = 0

If [forms]![form name]!checkbox1 = True then
total_amount = total_amount + [forms]![form name]!amount1
end if

If [forms]![form name]!checkbox2 = True then
total_amount = total_amount + [forms]![form name]!amount2
end if

If [forms]![form name]!checkbox3 = True then
total_amount = total_amount + [forms]![form name]!amount3
end if
 

Users who are viewing this thread

Top Bottom