Sub Querydocumentdelete(Source As Notesuidatabase, Continue As Variant)
On Error Goto ERRORHANDLER
Dim db As NotesDatabase
Set db = Source.Database
Dim strMsg As String
Dim workspace As New NotesUIWorkspace
Dim noteid As String
Dim rc As NotesDocumentCollection
Dim dc As NotesDocumentCollection
Set dc = Source.Documents
Dim doc As NotesDocument
Dim g As Integer
For g=1 To Source.Documents.Count
Set doc = Source.Documents.GetNthDocument( g )
If( doc.IsUIDocOpen ) Then
noteid = doc.NoteID
Delete doc
Set doc = Source.Database.GetDocumentByID( noteid )
End If
Call doc.Remove( True )
Next
Continue = False
Call workspace.ViewRefresh
EXITSCRIPT:
Exit Sub
ERRORHANDLER:
Call ErrorMessage("Database Script: QueryDocumentdelete")
Resume EXITSCRIPT
End Sub