Link to home
Start Free TrialLog in
Avatar of gbnorton
gbnortonFlag for United States of America

asked on

Access form text box event for constantly totalling

We have a form that records the number of wafers per container using text boxes.    There are 34 of these text boxes.  At the bottom of the form is a text box for the total number of wafers from the 34 text boxes.   As the user enters in the number of wafers per container, we need the total number of wafers text box to update with the total quantity.  Will I need to have an event for every ‘per container’ text box to update the ‘total quantity’ text box?  A better way?
Avatar of omgang
omgang
Flag of United States of America image

Create a Form level function or subprocedure to update the 'total quantity' text box.  Call it from the AfterUpdate event of each of the other text boxes.

Private Sub UpdateTotal ()
    Me.txtTotalQuantity.Requery
End Sub

Private Sub TextBoxNumber25()
    Call UpdateTotal
End Sub

I'm sure there are other ways...
OM Gang
ASKER CERTIFIED SOLUTION
Avatar of omgang
omgang
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Not sure on how your form is designed (Single form, Datasheet, Continuous,), or if it is Bound or not.
Also not clear on what the source data is.

If this were a "Normalized" design the textboxes instead would be "Rows" in a single "Field"
This way you could simply do this to get a total in the form footer:
=Sum(YourField)

Then each time you updated a value or created a record (Row), the total will update automatically.

JeffCoachman
Avatar of gbnorton

ASKER

Thanks!