The following script has been compiled mainly with the Assistance of the resident experts but I have a small problem.
The script is intended to record a single multi-day event as a series of seperate single day events, and it does.
However, the multi-day event is also being recorded.
ie. An event runs from Mon to Wed, db is correctly recording an event for Mon, an event for Tue and an event for Wed but it is incorrectly also recording an event for Monday to wednesday.
How can I delete the multi-day event and retain the single day events that it created?
Private Sub Command18_Click()
Dim rst As DAO.Recordset
Dim dtLeave As Date
Set rst = CurrentDb.OpenRecordset("tblLeaveEvent")
dtLeave = Me.LeaveStart
Do Until dtLeave = Me.LeaveFinish
If Weekday(dtLeave, vbMonday) < 6 Then
rst!UserID = Me.UserID
rst!LeaveType = Me.LeaveType
rst!LeaveStart = dtLeave
rst!LeaveFinish = dtLeave + 1
dtLeave = dtLeave + 1
Set rst = Nothing