OK.
I suspect this has been a struggle to implement because the tables as
designed are not normalized. Normalization is a set of rules for relational
databases that improve performance and minimize "workarounds". Here are some
of the rules:
- Fields should be atomic, i.e., broken down as far as possible. E.G., use
FName and LName rather than a single Name field. By the way, "Name" is a
reserved word in Access, being a property of a control. Naming fields with
reserved words can lead to perplexing bugs in your application's performance.
You can get a full list by a Google search on "Access Reserved Words".
- Each record should have a unique identifier, or primary key (PK).
- The PK is a field or fields that uniquely identify the record.
- The PK should be short, stable, and simple--as little memory as possible,
that doesn't change, and easily understood. For this reason, I almost always
use an AutoNumber primary key rather than a compound key made up of more than
one field.
- Each field should supply additional information (or properties) of the
record that the PK identifies, e.g., each field of a record in an Orders
table should describe aspects of *that* order -- its order number, the
customernumber, the date.
- Data should, in general, be stored in a single table, e.g., the
CustomerName and his address, telephone, etc., should be defined in a single
record in the Customer table. To specify this customer in say, an Orders
table, include a numeric CustomerNumber field in the Orders table's
structure. DO NOT include his name, address, or any other fields from the
Customer table. Should a customer change their phone, or address, you make
one simple change in the Customer table.
I like to think about normalization with tables analogous to "things", and
fields analogous to "properties", or "traits". Each field is a unique
property of this particular thing.
As far as relationships between different tables, there are 3 types:
1-to-1, 1-to-many, many-to-many. The latter cannot be described in Access
directly, it must be simulated by two 1-to-many relationships. 1-to-many is
the most typical--a Customer can place many orders, etc.
If you find that your structure is in a 1-to-1 relationship, 99% of the
time, it would be far simpler to simply include the fields from the second
table in the first. This is what I would suggest here--move the In, LOut,
LIn, and Out fields to the first table. Further, following the normalization
rules above, you should remove the Name field from the table's structure, and
include it only in an Employees table, preferably splitting it into the first
and last name.
My personal preference, and that of many developers, would be to add an
Autonumber field to your table, and make that the primary key, rather than
the compound one of EENO and Date. If you do this, and yet wish to prevent a
user from adding a second record for an employee for a given date, you can
add a unique compound index in table design view (see help under Index for a
step-by-step guide) that will prevent this.
If you wish, even though the data is being stored in the same table, create
separate forms for scheduling and for posting the actual work times.
HTH
Sprinks