Susan said:
I often read through the messages to learn -- and found
that this is one of the subjects I am reading up on. My
situation is a payroll table that I want to keep
historically with a date, hrs, payrate (to run reports on
request for any time period). My first thought was to
make a table with 52 fields (one for each week of the
year) and at the end of the year save that data to a zip
disk and rename the table on Access for the current year.
Is there a better way to do this? Thanks - Susan
<wince> Yes.
You are making the common error of organizing your data tables based on
your desired end product...a report with information grouped by each
week of a given year. Access is a _relational_ database. Use it
relationally, instead of "committing spreadsheet"! Having separate
fields for every week, and a separate table for every year <shudder>, is
not what is known as a Normalized design. In order to take advantage of
the relational capabilities of Access, your data tables should be
organized so that each field represents a unique type of information.
Repeating fields (Week1, Week2, ...,WeekX) waste space, since tables can
only expand horizontally so far, and also wastes disc storage space by
storing information that can easily be calculated in a query, form, or
report (see the OLH for the DatePart() function). And repeating tables
with identical structures (FY97, FY98,...,FYxx, all containing the
fields EmployeeID, date, hours, payrate) are also a violation of
database normalization rules. Your basic table design (assuming there is
some kind of identifier like EmployeeID, and some kind of primary key,
in there) is fine. I'm also assuming you also have a separate Employees
table (if not, you certainly should). With just these two tables,
related 1-m (each Employee appears only ONCE in tblEmployees, but
multiple times in tblPayroll, since each Employee is paid in multiple
pay periods [one would hope!]), you can easily retrieve the information
you want in the desired form. And it means not having to rebuild your
tables from scratch every year.
Hope this helps. Post back if you have any additional questions.
Good luck!
LeAnne