figured this out, created 5 queries
qryClearST - clear tblScheduleTemp
(no need to show this as simple)
qryAppendST - append rows (snippet below)
Code:
INSERT INTO tblScheduleTemp
SELECT H1.fldHID AS fldHID, H1.fldHMonthStartDate AS fldHMonthStartDate, H1.fldHJID AS fldHJID, H1.fldHMonthPercentageComp AS fldHMonthPercentageComp, H1.fldHStaff AS fldHStaff,
(SELECT COUNT(SD1.fldHID)>0 FROM tblScheduleDates SD1 WHERE (SD1.fldHID=H1.fldHID) AND Day(SD1.fldHScheduleDate)=1) AS fldHDay01,
...
(SELECT COUNT(SD1.fldHID)>0 FROM tblScheduleDates SD1 WHERE (SD1.fldHID=H1.fldHID) AND Day(SD1.fldHScheduleDate)=31) AS fldHDay31
FROM tblSchedule AS H1
WHERE month(H1.fldHMonthStartDate)=fldMonthNum AND year(H1.fldHMonthStartDate)=fldYearNum;
qryUpdateH - update tblSchedule
(no need to show this as simple)
qryDeleteSD - delete current month/year items from tblScheduleDate
(no need to show this as simple)
qryAppendSD - append all current month/year items
Code:
INSERT INTO tblScheduleDates ( fldHID, fldHScheduleDate )
SELECT HID, ScheduleDate
FROM
[
SELECT ST1.fldHID as HID, ST1.fldHMonthStartDate+0 as ScheduleDate
FROM tblScheduleTemp ST1
WHERE (ST1.fldHDay01)=True
UNION ALL
SELECT ST1.fldHID, ST1.fldHMonthStartDate+1
...
UNION ALL
SELECT ST1.fldHID, ST1.fldHMonthStartDate+30
FROM tblScheduleTemp ST1
WHERE (ST1.fldHDay31)=True]. AS [%$##@_Alias
];
The items in tblScheduleDate have no ID and do not need one, so deleting then adding the items (around 15 of them) is not a problem in this case.
Appologies for my incorrect formatting previously, i understand how messy this thread looks.
Look forward to participating more in the future.
Ian