Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / General 2 / July 2007

Tip: Looking for answers? Try searching our database.

Add up fields within a Form

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Pass-the-reality - 30 Jul 2007 17:30 GMT
I have a form (frmTesterInfo).  Within the form, I have 4 text boxes.  The
text boxes are Total Executed, P, RB and FB. I want the text box Total
Executed to add up the data that is keyed into P, RB and FB.  I tried to
create a Macro (SetValue) and I could not get it to work.  What is the
easiest way to get these fields to add up.   Plus, I need to be able to
store the Data  in the table, That is a MUST.  How can I get this to work?
Jeff Boyce - 30 Jul 2007 17:45 GMT
If you MUST store a calculated value in a table, you MUST create a procedure
that ensures your data's integrity.  If any of the components (or the stored
total) is modified, either via forms or directly in the table or via code,
YOU are responsible for ensuring that the calculation/re-calculation takes
place, and all four values are still in synch.

Or you could take a somewhat easier approach and use a query to derive the
calculated value whenever you need it, and only store the raw values.

To get the form (not the table) to display the calculated value, you could
use an unbound textbox, and in the Control Source property, put something
like:

   = [P] + [RB] + [FB]

You may need to re-calculate the form after any change to any of those three
components.

Regards

Jeff Boyce
Microsoft Office/Access MVP

>I have a form (frmTesterInfo).  Within the form, I have 4 text boxes.  The
> text boxes are Total Executed, P, RB and FB. I want the text box Total
> Executed to add up the data that is keyed into P, RB and FB.  I tried to
> create a Macro (SetValue) and I could not get it to work.  What is the
> easiest way to get these fields to add up.   Plus, I need to be able to
> store the Data  in the table, That is a MUST.  How can I get this to work?
molsonexpert - 30 Jul 2007 17:45 GMT
I would create an unbound text box whose control source is the addition of
the amounts in the four text boxes. Why must the data be stored in a table
(I can tell you right now, there are very few (if any) valid reasons why
this should be done)? You could run a mcro or some VBA script that updates
that field in the table with that of the unbound text box, but again, a bad
idea. What if the program crashes, for example, the field doesn't get
update?

Signature

steve.

>I have a form (frmTesterInfo).  Within the form, I have 4 text boxes.  The
> text boxes are Total Executed, P, RB and FB. I want the text box Total
> Executed to add up the data that is keyed into P, RB and FB.  I tried to
> create a Macro (SetValue) and I could not get it to work.  What is the
> easiest way to get these fields to add up.   Plus, I need to be able to
> store the Data  in the table, That is a MUST.  How can I get this to work?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.