?
Solved

Access form text box event for constantly totalling

Posted on 2011-09-15
4
Medium Priority
?
266 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 2000 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

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

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

In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
Suggested Courses

762 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