Check box to perform calculation (but w/ more than one boxes checked)!

Oimoi

Registered User.
Local time
Today, 17:19
Joined
Jul 17, 2011
Messages
42
Afternoon all. :)

I've been working on a registration form where students can enroll in classes.

So far, they can enroll in multiple classes through a subform in continuous form, and the tuition total is calculated in the subform's footer. I then created a text box in the main form that refers to this subtotal, and I have a separate textbox that is bound to the main form called "PaymentAmount" which calculates TOTAL fees for the student.

For example, additional fees may be added onto the tuition total, and these are indicated by check boxes. I want to be able to perform a simple calculation (e.g. add $30 to tuition total) upon checking the corresponding box. HOWEVER, several boxes might be checked, and I don't know how to get the "PaymentAmount" to change accordingly.

The following code seems to work for just one check box at a time (On Click event), but how do I go about adding a $30 fee and possibly ANOTHER whatever-dollar fee by checking two or more boxes?

If Me.ckAppFee = True Or Me.ckLateFee = True Or Me.ckTestFee = True Then
Me.PaymentAmount = Me.TuitionTotal + 30

End If

If Me.ckAppFee = False And Me.ckLateFee = False And Me.ckTestFee = False Then
Me.PaymentAmount = Me.TuitionTotal

End If


(I hope my rambling makes sense. And I'm just getting into VBA, so apologies if my "coding" is confusing.)
 
Argh, typo in thread title. "...more than one box checked!"

Sorry. :O
 
Problem solved!

I just created another field called FeeTotal which accounted for the total cost of additional fees, completely separate from the TuitionTotal.

PaymentAmount then equals FeeTotal + TuitionTotal.

Then after a bit of coding (and nested IF-THEN-ELSE statements), I got the following:

Private Sub ckAppFee_Click()

If Me.ckAppFee = True Then

If Me.TotalFees = 0 Then

Me.TotalFees = 30

Else

Me.TotalFees = Me.TotalFees + 30

End If

Else

Me.TotalFees = Me.TotalFees - 30

End If

End Sub
 
Just kidding. I've run into another roadblock and would appreciate any tips.

Where exactly do I put the statement "PaymentAmount = FeeTotal + TuitionTotal"? Would I be dealing with a property of PaymentAmount's textbox? Or the main form's? Or none of the above? :o
 
Ah - apparently it's bad form to store derived values!

Gonna fiddle with reports then. :)
 

Users who are viewing this thread

Back
Top Bottom