473,386 Members | 1,743 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Saving calculated values

SJH
I have been given an older database and asked to make upgrades and what not.
One interesting thing I have come across with the database is that it was at
one time set up so one of the tables would hold values that were calcuated
using a form. I have looked at the code for all the text boxes on the
assocatied forms and have yet to figure out how this was done. There were
two values set up this way, one still works and the other one doesn't,
needless to say this has turned the reports into a mess.

I know all about manipulating data using queries, but these values are
stored values that will not change once they have been calculated.

Can someone point me in the right direction as to how calcualted values can
be stored in a table? I am not all that familiar with writing code, but I
can usually figure it out once I see it.

Thanks for any help anyone can offer.

SJH


Nov 12 '05 #1
1 2916
"SJH" <12*****@wwt.net(remove first two)> wrote in message news:<7I******************@reggie.win.bright.net>. ..
I have been given an older database and asked to make upgrades and what not.
One interesting thing I have come across with the database is that it was at
one time set up so one of the tables would hold values that were calcuated
using a form. I have looked at the code for all the text boxes on the
assocatied forms and have yet to figure out how this was done. There were
two values set up this way, one still works and the other one doesn't,
needless to say this has turned the reports into a mess.

I know all about manipulating data using queries, but these values are
stored values that will not change once they have been calculated.

Can someone point me in the right direction as to how calcualted values can
be stored in a table? I am not all that familiar with writing code, but I
can usually figure it out once I see it.

Thanks for any help anyone can offer.

SJH

first let me say that I'm not sure storing the calculated values is a
great idea. Just base your report on a query that does the
calculations at runtime.

Okay, that said - there's one way to do it *BEFORE* the record is
saved - just put the code to update the values in the BeforeInsert
event of your form. You could have the calculated fields be invisible
and then do something like:

Me.CalcField1=Expression1(Field1,Field2,Field3)
Me.CalcField2=Expression2(Field3,Field4,Field5)

I don't like this approach at all... what if someone changes any of
the values in fields 1-5? Your calculations go up in smoke. That's
what I really don't like about the scenario you describe. So it takes
a few extra seconds for the report to open... big deal. At least the
data is ALWAYS current if you just base it off a query (or several)
and just calculate everything at runtime.

There. I said it. But I wouldn't do what you're proposing unless you
are absolutely sure you want just "historical"/ReadOnly data after
that. If I were going to do that, then I'd skip the complexity and
just use update/append queries to write the calculated values to a
temporary table, then run my reports and then drop the temp tables.
See Tony Toews site for info on temp tables.
Nov 12 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Stefanos | last post by:
Hi everybody, I need some help on calculated values in my database design. I'm creating an accounting / business management application with the usual modules like A/R, A/P, Inventory, etc. ...
0
by: Henry | last post by:
Hi Is there any good ideas how to update form vb code always after some values are changed / added by vb (not user). I have some code behind subforms vb and there are calculations behind...
3
by: Jeremy Weiss | last post by:
I've got a temp table that contains the fields: amountowed, amountpaid, and balanced. I've got a form that shows this information and I've set it up so that when the amountpaid field is changed it...
2
by: Douglas Buchanan | last post by:
I set the OnExit property of the "Cost" field in subform "subJobDetail" to save the record (see below). Then I call a global sub to copy the )] calculated field to a field in the subform "subJob"....
0
by: douh | last post by:
I know that this is not the way, however I need to save certian calculated values so that they do not change over time, ie. new tax rates etc. This is for an invoice header and invoice subform. I...
1
by: douh | last post by:
I know that this is not the way, however I need to save certian calculated values so that they do not change over time, ie. new tax rates etc. This is for an invoice header and invoice subform. I...
18
by: TORQUE | last post by:
Hi, Im wondering if anyone can help me with a problem. I have a form with more than 50 unbound fields. Some of the fields will be blank from time to time. This seems to be where im having...
11
by: James Hallam | last post by:
I have read through all the past topics and couldn't find what I was after so... I am looking to store some calculated values (don't flame just yet, just read on!). I have an piece of code...
8
by: Gilberto | last post by:
Hello, I have created a query to help me calculate some total values i need for a report. In the query field i have the following: TCL1: Costing!*(Engineering!+Engineering!) The results...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.