?
Solved

adding values in textboxes MS Access

Posted on 2012-09-10
3
Medium Priority
?
288 Views
Last Modified: 2012-09-11
I have an access form with 4 textboxes on it formatted as currency.

textbox1
textbox2
textbox3
textboxTOTAL

The user will enter dollar values in the first 3 textboxes and I want the total displayed in textboxTOTAL.  If the user makes a change to any of the values,  I want the total to be recalculated.  And how do I avoid confusing things such as when a total already exists in textboxTOTAL and the user makes a change to any of the texboxes that is not immediately reflected in textboxTOTAL.

For example, let's say these are currently the textbox values:

textbox1                  $1000
textbox2                  $5000
textbox3                  $4000
textboxTOTAL        $10000

Now let's say a user deletes the data in textbox1.   How do I avoid things like the following:

textbox1                  
textbox2                  $5000
textbox3                  $4000
textboxTOTAL        $10000    <----value is still showing $10K even  

So I'm also looking for the proper way to handle recalculations. Thank you.
0
Comment
Question by:dbfromnewjersey
  • 2
3 Comments
 
LVL 75

Accepted Solution

by:
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform) earned 2000 total points
ID: 38384570
Control source for textboxTOTAL

=Nz([textbox1],0) + Nz([textbox2],0) + Nz([textbox3],0)

This deals with Null values

It should ... recalc automatically.  Try the above and report back in still updating.

mx
0
 

Author Comment

by:dbfromnewjersey
ID: 38387644
Thank you.
0
 
LVL 75
ID: 38388456
You are welcome ...

mx
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

807 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