Solved

Access form text box event for constantly totalling

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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…

734 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