Solved

Access form text box event for constantly totalling

Posted on 2011-09-15
4
229 Views
Last Modified: 2012-08-13
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?
0
Comment
Question by:gbnorton
  • 2
4 Comments
 
LVL 28

Expert Comment

by:omgang
ID: 36543131
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
0
 
LVL 28

Accepted Solution

by:
omgang earned 500 total points
ID: 36543136
Sorry, should have been

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

Private Sub TextBoxNumber25_AfterUpdate ()
    Call UpdateTotal
End Sub
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 36544651
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
0
 

Author Closing Comment

by:gbnorton
ID: 36556506
Thanks!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In the article entitled Working with Objects – Part 1 (http://www.experts-exchange.com/Microsoft/Development/MS_Access/A_4942-Working-with-Objects-Part-1.html), you learned the basics of working with objects, properties, methods, and events. In Work…
QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now