Dear Steve:
This is to answer your one question: "If I go back to the two field
structure do you know how I can use the form with the employee names
and checkboxes?"
First of all, you need to be able to represent the data in "Day of the
Week Columnar Fashion" even though it isn't stored that way. You
could use a crosstab query for this, but I wouldn't. Rather, I would
use a query with subqueries for the days of the week. I'll call this
the "Transformation Query." This will transform the data into the 8
column appearance: EmpNbr and 7 days of the week.
SELECT EmpNbr,
IIf((EXISTS SELECT * FROM NewTable NT WHERE NT.EmpNbr = ET.EmpNbr
AND DayOff = 1), -1, 0) AS Sun,
IIf((EXISTS SELECT * FROM NewTable NT WHERE NT.EmpNbr = ET.EmpNbr
AND DayOff = 2), -1, 0) AS Mon,
IIf((EXISTS SELECT * FROM NewTable NT WHERE NT.EmpNbr = ET.EmpNbr
AND DayOff = 3), -1, 0) AS Tue,
IIf((EXISTS SELECT * FROM NewTable NT WHERE NT.EmpNbr = ET.EmpNbr
AND DayOff = 4), -1, 0) AS Wed,
IIf((EXISTS SELECT * FROM NewTable NT WHERE NT.EmpNbr = ET.EmpNbr
AND DayOff = 5), -1, 0) AS Thu,
IIf((EXISTS SELECT * FROM NewTable NT WHERE NT.EmpNbr = ET.EmpNbr
AND DayOff = 6), -1, 0) AS Fri,
IIf((EXISTS SELECT * FROM NewTable NT WHERE NT.EmpNbr = ET.EmpNbr
AND DayOff = 7), -1, 0) AS Sat
FROM EmpTable ET
This would certainly not be updatable, but only suitable for a report
or read-only form. You are probably intending the form to be updating
the data.
To do this, you need to have a temporary table in the 8 column format
into which you insert all the rows from the transformation query
above. You can then edit the table in the non-normalized form but
save the results (though a UNION query as shown before) back to a
normalized form.
This is not the sweetest operation I've seen, but it will work well in
most cases.
I have not touched yet on conflict resolution, which would be an issue
if there could be multiple users accessing this functionality
simultaneously.
We've built such things several times, but you're approaching a fairly
high level of "Expert Programming" here to do it the way we have. I
haven't heard of anyone else doing "Interactive Crosstab Forms" but
I'd love to hear other's ideas on it.
I will say that the results are quite gratifying when you finish one
of these (assuming you don't lose your hair or your job along the
way).
Tom Ellison
Microsoft Access MVP
Ellison Enterprises - Your One Stop IT Experts