=loOneContact.Delete()
BTW, you can use < pre > tag to preserve code formating in a message.> *-- Delete contact if found > IF ISNULL( loOneContact ) > lnResult = NOT_FOUND_BY_OUTLOOK && Not found in Outlook > ELSE > *-- Start 13/06/2002 > *-- Lloyd Grant > *-- I found that the contact was not deleted if I didn't include > *-- this WAIT WINDOW. I messed about with AutoYield and that didn't > *-- make any difference. If I traced through the code via the debugger > *-- it worked OK. I can't explain this, but the WAIT WINDOW > *-- fixes it so the contact is deleted. Very strange :/ > *-- Start 02/07/2002 > *-- Lloyd Grant > *-- This still does not fix it, so some code has been added to > *-- try again with some delay etc to try it a second time... > > *-- Lloyd Grant > *-- End 13/06/2002 > > THIS.lStopOnError = .F. > THIS.lErrorOccured = .F. && Reset any error condition > loOneContact.Delete() > llSuccess = NOT THIS.lErrorOccured > THIS.lStopOnError = llStopOnError > *-- Start 02/07/2002 > *-- Lloyd Grant > *-- Weird problem, somedays we can delete the contact, others we can not. > *-- Issue a sleep and see if that helps... > IF llSuccess > loOneContact = NULL > ELSE > loOneContact = NULL > THIS.lErrorOccured = .F. && Reset any error condition > loOneContact = THIS.FindContact( lcOutlookProperty, lcPropertyValue ) > llSuccess = NOT THIS.lErrorOccured > *-- Another vague attempt to fix the problem, invert the autoyield > _VFP.AutoYield = NOT _VFP.AutoYield > *-- Tell VFP to do anything that is floating around > DOEVENTS > *-- Now wait a while > DECLARE Sleep IN win32api INTEGER > Sleep( 100 ) > WAIT WINDOW "" NOWAIT > THIS.lErrorOccured = .F. && Reset any error condition > THIS.lStopOnError = .F. > loOneContact.Delete() > llSuccess = NOT THIS.lErrorOccured > THIS.lStopOnError = llStopOnError > IF llSuccess > loOneContact = NULL > ENDIF > ENDIF > *-- Lloyd Grant > *-- End 02/07/2002 > >*!* loOneContact = NULL > > IF llSuccess > lnResult = CONTACT_DELETED && Found and deleted > ELSE > lnResult = CONTACT_FAILED_TO_DELETE > ENDIF > ENDIF > ELSE > lnResult = FIND_FAILED_TO_RUN > ENDIF