help: 删除文档
Dim s As New notessession
Dim db As notesdatabase
Set db=s.currentdatabase
Dim w As New notesuiworkspace
Dim uidoc As notesuidocument
Set uidoc=w.currentdocument
Dim view As notesview, view1 As notesview
Set view=db.getview("chjguanli")
Set view1=db.getview("chongxview")
Dim doc As notesdocument
Set doc=uidoc.document //chjguanli视图中的当前文档
Dim deldoc As notesdocument
Set deldoc=view1.getfirstdocument
Messagebox(doc.xuehao(0)) //chjguanli中文档的xuehao域,但该显示框中无值??????
Messagebox(deldoc.xuehao(0))
Do While Not (deldoc Is Nothing)
If doc.xuehao(0)=deldoc.xuehao(0) Then
Call doc.remove(True)
Call deldoc.remove(True)
End If
Loop
问题点数:100、回复次数:4Top
1 楼woodsays(木头说)回复于 2002-05-09 12:07:23 得分 50
Dim S As New NotesSession
Dim curDb As NotesDatabase
Dim tmpView As NotesView
Dim tmpDoc As NotesDocument
Set curDb = S.currentDatabase
Set tmpView = curDb.getView("AnswersCollection")
Call DelAllDocs(tmpView)
Set tmpView = curDb.getView("CategoryAnswer")
Call DelAllDocs(tmpView)
'YOU MAY SEE THE FOLLOWING CODE !!
Sub DelAllDocs (viewName As NotesView)
Dim tmpBeginDoc As NotesDocument
Dim tmpNextDoc As NotesDocument
Set tmpBeginDoc = viewName.getFirstDocument
Do While Not (tmpBeginDoc Is Nothing)
Set tmpNextDoc = viewName.getNextDocument(tmpBeginDoc)
If Not (tmpNextDoc Is Nothing) Then
Call tmpNextDoc.remove(True)
Else
Call tmpBeginDoc.remove(True)
Exit Do
End If
Loop
End SubTop
2 楼woodsays(木头说)回复于 2002-05-09 12:36:17 得分 0
DelAllDocs这段代码是删除指定VIEW中的所有文档。Top
3 楼fokker(独孤龙)回复于 2002-05-09 12:44:58 得分 20
你是要删除什么文档?Top
4 楼rosemerry(珏儿)回复于 2002-05-09 13:17:30 得分 30
少了else
set deldoc=view1.getnextdocument,否则要死循环的!!
你找到了相同域值删除文档,如果没有找到还是对那个文档进行比较,会死循环!
显示框中无值?是视图中无值还是表单中无值?Top




