Solved

Access form text box event for constantly totalling

Posted on 2011-09-15
4
217 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

It took me quite some time to sort out all the different properties of combo and list boxes available from Visual Basic at run-time. Not that the documentation is lacking: the help pages are quite thorough and well written. The problem was rather wh…
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…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

760 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

18 Experts available now in Live!

Get 1:1 Help Now