Error handle to skip segment

I have the following code.

Set view = db.getView(“PrivateFolder”)

Do Until Doc Is Nothing	

	Set Doc = view.GetFirstDocument

	Call doc.RemoveFromFolder( "PrivateFolder" )

Loop

However, upon first execution, the PrivateFolder does not exist, and continues to loop. I want to be able to run this only after the Private Folder has been created. Should I use an errorhandle for this, or is there a better method?

Subject: error handle to skip segment

try NotesDocumentCollection.RemoveAllFromFolder

Subject: RE: error handle to skip segment

Thanks Bob, but I believe that will still result in an error if the Folder has not yet been created.

Subject: RE: error handle to skip segment

if the view has not been created yet it will be null, just test for that

Subject: Check view object…

Try this…

Set view = db.getView(“PrivateFolder”)

If Not view Is Nothing Then

Do Until Doc Is Nothing

Set Doc = view.GetFirstDocument

Call doc.RemoveFromFolder( “PrivateFolder” )

Loop

End if

Subject: RE: Check view object…

Alex, you were dead on. The ‘If Not View’ statement was something way at the back of my mind but you touched it. Thank you.