I want to store "redundant data"

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi

Why is everyone hiding for this issue??...saying not recommended, redundant
data, etc. but no one tells me it is impossible to do...and I very much need
to do it...and I think I can have it under control.

Se more below.

Best wishes

Mattias

Mattias said:
I have a form with ontimer event where starts on the first record when it
open, then via a gotonextrecord func to the last record in the recordset.

For every record I want to save the calculated value from Total and
TotaltInbetalt to the bound controls Total2 and TotaltInbetalt2.

Tried the on current below but did not autosave when from one record to
another!


Private Sub Form_Current()
Me!Total2 = Nz(Me!Total)
Me!TotaltInbetalt2 = Nz(Me!TotaltInbetalt)
'DoCmd.RunCommand acCmdSaveRecord
End Sub

Thank you in advance

Mattias

Why do you want to save a calculated field?

If you insist on doing so (not recommended to store redundant data) why are
you not using an update query?

Rick B

Hi Rick

This form is like a order or invoice with a unique invoicno. When the
invoices are created they have a null value in the fields Total2 and
TotaltInbetalt2 (=paid up to now) in the table.
This is because there is a lot of manual hands on and unique handling of
each invoice. One invoice can have 50 part payments, ex: 2 can be cash, one
partpayment can be credit card with adding a % fee to the total2, next can be
a partpayment in another currency adding adding a % fee (for the excange) to
the total2.

Once in a while I need to run throw all the records update the fields with
current values, and after that I want to run an updatequery to update the
invoicetable to the correct paymentstatus.

And since I cannot referense a Form object in an update query I need to
store the values to the table.

Mattias
 
Mattias said:
Hi

Why is everyone hiding for this issue??...saying not recommended, redundant
data, etc. but no one tells me it is impossible to do...and I very much need
to do it...and I think I can have it under control.

Se more below.

Best wishes

Mattias

Clearly from the answer you have already had, everyone is NOT hiding from
it! But, you've already had the answer, and I don't suppose anyone here is
going to tell you anything different - certainly not me. You do NOT need to
store redundant data: simply do the calculation wherever you output the
result, there is NO need to store it.

Also, your method of processing all the records in a form is absurd.
Contrary to what you say, you CAN reference a form in an UPDATE query, not
that I can see why you would want to in this instance.

You are not likely to get good results from this newsgroup if you insult
people here, however generally, e.g. by accusing them of "hiding". No-one
gets paid for being here, and no-one here owes you anything.
 
Hi,


Why? because it is a lost of time and effort. I won't paint the house
with a brush to paint a tableau, I won't teach to someone to do inefficient
work for, at the end, being tell by that same someone that what I teach was
completely inappropriate. Sure, you can bind your control, Total2, to a
field in the table, and, in the Form_Current event, but why will you save it
there is something completely out of usual : you mean that if a record is
NEVER presented to the end user, then that record WON'T be updated ? That
means you have, through time, updated record, IF they have been presented to
a user, and not updated records? How can you manage to handle such a bunch
of disparate records? How can you handle correction (human make error, you
do you re-update your computation)... or your application does not allow
human to make error ?



I would rather store the payment as they occur, and if a SUM is
required, then do it. Nothing fancy, just a sum of + and of - (what is due
and what is paid, of the reverse sign convention if you wish) and get the
date of the payment ( to compute the interest, of the applicable taxes that
can vary in time ) and rather than having a record that may or may not be up
to date, a query delivers you with the latest possible computed value.


Hoping it may help,
Vanderghast, Access MVP
 
This is like asking why no one will tell you how to make a hot-air balloon
with hydrogen. Sure it's possible, but it's dangerous and might blow up in
your face. No reputable balloonist will show you how. You might think you
have a good reason for it, but there are alternatives that are safer and
more effective.

--
--Roger Carlson
Access Database Samples: www.rogersaccesslibrary.com
Want answers to your Access questions in your Email?
Free subscription:
http://peach.ease.lsoft.com/scripts/wa.exe?SUBED1=ACCESS-L
 
Back
Top