a field automatically change every year

A

Anna

I'm working on an elementary database. There is a specific field for grader.
For example, there is a student who is first grader so I put G1. He will
become the second grader in Sept. I would like the field automatically change
to G2 in Sept. We have a thousand students. It's hard to change it manually.
I'm talking about something like age. The age field will change every year.
Thanks
 
A

Allen Browne

You raise an important point about database design, Anna.

It is imporant to store the data so it does not go out of date, so don't
store a student's age. Instead, store the date of birth, and have the
software calculate the age for you at the moment you need it. Otherwise your
database is wrong every day: with 1000 students, about 3 of them will change
their age every day! Computers are pretty good a computing things like age,
so don't waste your time updating fields the computer should calculate for
you. For info on how to calculate the age, see:
http://allenbrowne.com/func-08.html

But your main issue was enrollments. Over the years, a student will be
enrolled in many classes. As well as moving from year to year, a student
might switch streams during the year, or may even repeat a year. Since one
student has many enrollments, you need a *related* table to store the
enrollment info. You do not put a field in the student table for the current
grade. If that is a new concept, it will be important to follow it up, since
the idea of one-to-many relationships is the core concept behind relational
databases like Access.

If you want to continue with the flat-file approach you have (where
everything goes into the Student table), and you don't care about the fact
that you now have no history of the classes the student has been in, who
taught them, and you don't want to know when students switch steams, the way
you can update the Student table every year is to exeucte an Update query
that increments the value of the number in the field. Update is on the Query
menu in query design.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top