Go Back   Access World Forums > Microsoft Access Discussion > Forms

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 01-03-2006, 06:27 AM   #1
Durien512
Registered User
 
Join Date: Dec 2005
Location: NY,CT,MA
Posts: 61
Thanks: 0
Thanked 1 Time in 1 Post
Durien512 is an unknown quantity at this point
Storing a calculated control.??

if i have formula in a text box can that calculation be stored in a table???

example

sales total

sales tax

grand total

where grand total = sales tax+sales total

if the control is bounded to a field in a table once the formula is entered doesnt it loose the connection with the field???

right now when i enter a formula in a control it will no longer store it in the table but it will only show the result in the actual form..???

Durien512 is offline   Reply With Quote
Old 01-03-2006, 07:49 AM   #2
RuralGuy
AWF VIP
 
RuralGuy's Avatar
 
Join Date: Jul 2005
Location: @ 8300' in the Colorado Rockies
Posts: 13,821
Thanks: 7
Thanked 311 Times in 301 Posts
RuralGuy is just really nice RuralGuy is just really nice RuralGuy is just really nice RuralGuy is just really nice RuralGuy is just really nice
In order to store the value calculated in your TextBox you will need to add some code to the Form's BeforeUpdate event. You already know that it is bad practice to store calculated values unless there is some historical reason, as you have, where the sales tax rate might change. In the BeforeUpdate event of the form put something like:
Me![TotalSalesField] = Me!txtTotalSaleCalcControl

Using your control and field names of course.
__________________
(RG for short) aka Allan Bunch Previous MS Access MVP acXP, ac07, ac10, ac13 - WinXP Pro, Win7 Pro, Win10 Pro
Please post back to this Forum so all may benefit.
Teaching is not filling a bucket but lighting a fire.
RuralGuy is offline   Reply With Quote
Old 01-03-2006, 07:51 AM   #3
reclusivemonkey
Registered User
 
reclusivemonkey's Avatar
 
Join Date: Oct 2004
Location: West Yorkshire, U.K.
Posts: 749
Thanks: 0
Thanked 1 Time in 1 Post
reclusivemonkey is on a distinguished road
The calculated field is only shown in the form. You will need to use an update query to add the value to the table.

reclusivemonkey is offline   Reply With Quote
Old 01-03-2006, 08:07 AM   #4
neileg
AWF VIP
 
neileg's Avatar
 
Join Date: Dec 2002
Location: Newcastle, England
Posts: 5,975
Thanks: 0
Thanked 8 Times in 8 Posts
neileg has a spectacular aura about neileg has a spectacular aura about
Just to reiterate:

You don't store things that can be calculated from other stored data. If, as RuralGuy suggests, the tax rate may change, then it is legitimate to store the amount of the tax calculated. However, since grand total will always be sales total plus tax total, you should not save that value.
__________________
You can't always get what you want, but if you try sometimes you may just get what you need - Rolling Stones

Cheers, Neil
neileg is offline   Reply With Quote
Old 01-03-2006, 08:44 AM   #5
Durien512
Registered User
 
Join Date: Dec 2005
Location: NY,CT,MA
Posts: 61
Thanks: 0
Thanked 1 Time in 1 Post
Durien512 is an unknown quantity at this point
Thanks...makes sense...

Durien512 is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Storing a calculated field on a form nwardle Forms 22 10-28-2003 10:44 AM
Decimal places for a calculated report control. Everton Reports 0 11-23-2000 03:55 AM
[SOLVED] Calculated Control in a Report kdonnel1 Reports 1 08-07-2000 07:14 AM
Expression in calculated control Danielle Reports 3 04-26-2000 05:35 PM
storing values of a calculated field sush Forms 1 02-25-2000 10:50 PM




All times are GMT -8. The time now is 06:14 AM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Featured Forum post


Sponsored Links


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World