How do I make a database update a number each day

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

Guest

I want to add a number to my database, i.e, if someone has not attended a
course for 60 days I want the database to add 1 day each day I open up a
database so it reads 61 days and so on, does that make sense to anyone!!
 
You shouldn't store calculated values. As fellow Access MVP John Vinson
likes to say "Storing calculated data generally accomplishes only three
things: it wastes disk space, it wastes time (a disk fetch is much slower
than almost any reasonable calculation), and it risks data validity, since
once it's stored in a table either the Total or one of the fields that goes
into the total may be changed, making the value WRONG."

Instead, create a query that computes the value by using the DateDiff
function on the last attended date and the current date, and use that query
rather than the table.
 
You shouldn't store calculated values. As fellow Access MVP John Vinson
likes to say "Storing calculated data generally accomplishes only three
things: it wastes disk space, it wastes time (a disk fetch is much slower
than almost any reasonable calculation), and it risks data validity, since
once it's stored in a table either the Total or one of the fields that goes
into the total may be changed, making the value WRONG."

Put another way, if the calculation takes longer than a simple disk
read and you have validation rules on the dependency tree to prevent
values being changed or going out of sync then it's OK to store the
calculated value. For a real life example, consider a long XML message
generated using database values: do you impose a long wait upon users
while you regenerate the message each time on grounds of normalization
or do you simply stored the message once generated?

Sure, one *shouldn't* store calculated values but sometimes breaking
the rules is justified (not in the OP's case, though).

Jamie.

--
 
not related to the question, sorry!
but i keep seeing "OP" mentioned in some posts and wondered what it stands
for?
 
but i keep seeing "OP" mentioned in some posts and wondered what it stands
for?

Original Poster - the person who started the thread.

Often comes up when (as in this case) an answer sparks a discussion between
multiple people, and it gets hard to figure out who asked what.


John W. Vinson [MVP]
 
Back
Top