In my database I need to keep the offices calendar up to date with the
current information that my database is tracking. To do this I am
entering events as appointments. Entering them into outlook is not a
problem. The problem comes from when I want to mass delete
appointments. When I try to mass delete all the appointments from a
specific date to a specific date not all of the appointments are deleted
When I try this:
For Each objAppointment In myItems
' Testing if objAppointment is in range, if it is, it will
delete it
If DateValue(objAppointment.Start) <= dtmEnd And
DateValue(objAppointment.End) >= dtmStart Then
objAppointment.delete
End If
Next
When trying this method only half of the appointments are deleted
When I try this method:
Set objAppointment = myItems.GetFirst
Do While Not (objAppointment Is Nothing)
If DateValue(objAppointment.Start) <= dtmEnd And
DateValue(objAppointment.End) >= dtmStart Then
objAppointment.delete
End If
Set objAppointment = myItems.FindNext
Loop
This method always stops after myItems.FindNext, weither or not anything
is deleted, objAppointment is always set to nothing after Set
objAppointment = myItems.FindNext
I would like to come up with a better and cleaner method then adding a
while loop and a Boolean to the first one and setting the Boolean to
true when I delete something and running the loop again if I delete
something. While this would get the job done, I am looking for
something cleaner.
Thanks