I'm running Access 2003.
I am trying to establish a database that can be used year after year. In
it, I need to calculate estimated employee hours for each contract, spread
evenly over the course of the year. Our pay period ending dates are every
two weeks and change every year.
I don't think you want all the information about the tables/queries in the
database. Here are the pertinent fields in the tables/queries in question:
Employee Timesheet Allocation
Employee Name
Contract Number
PPE1 (Hours expected to work against contract in first pay period)
.
.
.
PPE26 (Hours expected to work against contract in last pay period)
This isn't a table. This is a SPREADSHEET.
"Fields are expensive, records are cheap". A much better design for
this would be to have *one* allocation per record:
EmployeeTimesheetAllocation <it's best to avoid blanks in names>
EmployeeID <DON'T use names as keys, they aren't unique and can
change>
ContractNumber
PPEDate
ExpectedHours
Hours Recorded
Employee Name
Contract Number
PPE Date
Actual hours worked during pay period associated with PPE Date.
PPE Dates - one record with 26 fields
PPE1 (Picks up first PPE date from another table)
PPE2 (Adds 14 days to PPE1)
PPE3 (Adds 28 days to PPE1)
Again - this is incorrectly normalized. Just a table with one field,
one date per record, named PPEDate.
.
.
PPE26 (Adds 350 days to PPE1)
My end goal is to be able to total up all the hours recorded in the time
dump (by contract). Then add all FUTURE estimates to the expended time. I
cannot see how to get a query to substitute/link the PPE DATE for the PPE#
that is in my timesheet allocation table. Or how to say if the date is
greater than the last date in the time dump, take all associated PPE#s from
the PPE Dates query and use those PPE#s in the estimates table and add up the
associated times.
Easy using a Totals query if you design your table correctly.
Nightmarishly difficult with your wide-flat design.
I feel like I'm rambling but I can't think of a better way to explain what
I'm trying to do. Am I completely out in left field with the way I've set up
my database? Is there a way to do this calculation/substitution?
Yes, and yes. See above.
Thanks in advance for any help you can give me.
Check out the links at
Jeff Conrad's resources page:
http://home.bendbroadband.com/conradsystems/accessjunkie/resources.html
The Access Web resources page:
http://www.mvps.org/access/resources/index.html
especially the "Database Design 101" link on Jeff's page.
John W. Vinson[MVP]