By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,456 Members | 1,251 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,456 IT Pros & Developers. It's quick & easy.

Saving calculated values

P: n/a
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
Share this Question
Share on Google+
1 Reply


P: n/a
"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 discussion thread is closed

Replies have been disabled for this discussion.