?
Solved

display total of three fields in one field on form

Posted on 2011-10-31
7
Medium Priority
?
314 Views
Last Modified: 2012-08-14
Hello,
have attached sample db- when it opens a form comes up.
I want the field [total] - to display the total of 3 other fields on the form-[size1],[height1],[weight1]

thank you
data123.accdb
0
Comment
Question by:davetough
  • 4
  • 3
7 Comments
 
LVL 61

Expert Comment

by:mbizup
ID: 37060286
Use the following in the Control Source Property for that textbox (include the = sign):

= [size1] + [height1] + [weight1]

0
 
LVL 61

Expert Comment

by:mbizup
ID: 37060292
Just a note on the above - That will display the total in the textbox, but not actually record it in the table.

In general, derived (calculated) values like this should be calculated and displayed on an as-needed basis, not stored in the table.  Storing in the table creates redundant data, and can complicate things if any of the parts of the calculation (such as height1) changes.
0
 

Author Comment

by:davetough
ID: 37060451
question: is there anyway to have total calculated and also entered into table?
I realize what you are saying about redundant data- but I am also trying to provide solution that is being asked for.
but if not possible- let me know-
thank you
0
 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

 

Author Comment

by:davetough
ID: 37060457
thinking this over- you may be right not to have entered in table- but i will leave last question stand - just for my own curiosity
thank you
0
 
LVL 61

Accepted Solution

by:
mbizup earned 2000 total points
ID: 37060494
You can enter data like this into a table - similar to how you did it in your timestamp question, and similar to how it looked like you were trying to set the text box up for this question.

If you have a textbox bound to the underlying field (Total), you would use the following statement to update the textbox (and the table field it is bound to):

Me.txtMyTextbox = [size1] + [height1] + [weight1]

(I have your database downloaded on another computer, so the textbox name here is just an example).

The difference between this scenario and your timestamp scenario is that your timestamp is a one-time calculation based on user input  that is historically significant (it needs to be stored).

The total is not historically significant.  In fact it needs to change to reflect changes in the other fields. It can be stored, but if it is stored, it needs to be updated each time any of the three fields changes (so it is best to be calculated and displayed on the fly)

0
 

Author Closing Comment

by:davetough
ID: 37061752
Thanks for explanation and solution
0
 
LVL 61

Expert Comment

by:mbizup
ID: 37061779
Glad to help out.
0

Featured Post

NEW Veeam Backup for Microsoft Office 365 1.5

With Office 365, it’s your data and your responsibility to protect it. NEW Veeam Backup for Microsoft Office 365 eliminates the risk of losing access to your Office 365 data.

Question has a verified solution.

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

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 …
Instead of error trapping or hard-coding for non-updateable fields when using QODBC, let VBA automatically disable them when forms open. This way, users can view but not change the data. Part 1 explained how to use schema tables to do this. Part 2 h…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

862 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