470,591 Members | 1,475 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,591 developers. It's quick & easy.

Problems deleteing appointments in Outlook from Access

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
Jun 9 '07 #1
0 1387

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Mark | last post: by
1 post views Thread by keri | last post: by
2 posts views Thread by =?Utf-8?B?RU1jQ2FydGh5?= | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.