Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Subtotals on a form

Status
Not open for further replies.

MrsNic

Instructor
Feb 6, 2005
44
GB
I have a simple form that lists training sessions someone has attended. Some have been paid for (shown with a tick box, some haven't. I ant to be able to toal the 2 separately so that I can take the paid total from the unpaid total. I know it must be simple, but I just can't think.

The two tables concerned are Session - which has the cost of the training session and stafftraining which has the information regarding if a person has completed the training.

Many thanks
 
If the information is displayed in the form and you want to perform the math after that, you can loop through the text boxes that contain the $ and if the box is checked add the values and if the box is checked assign that value to a different variable.

Maybe someting like:
Code:
Dim ctl As Control

For Each ctl In Me.Controls

    With ctl
        If TypeOf ctl Is TextBox Then 
             If Textbox.Name="YourTextBox" and Checkbox=1
          paidsum=paidsum+yourtexbox
             Else
          unpaid=unpad+yourtextbox  
        End If
    End With
Next
Then you can display "paidsum" and "unpaid" in text boxes on the form. HTH
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top