Dim db As New NotesDatabase( "", "somedocs.nsf" )
Dim parentDb As NotesDatabase
Dim collection As NotesDocumentCollection
Dim doc As NotesDocument
Set collection = db.AllDocuments
Set doc = collection.GetFirstDocument
Set parentDb = doc.ParentDatabase
Messagebox( db.Title )
Messagebox( parentDb.Title )
Function GetParentDocument( doc As NotesDocument )
Dim db As NotesDatabase
Dim parentDoc As NotesDocument
Set db = doc.ParentDatabase
If doc.IsResponse Then
Set parentDoc = db.GetDocumentByUNID _
( doc.ParentDocumentUNID )
End If
Set GetParentDocument = parentDoc
End Function
この関数は任意のスクリプトから呼び出し可能です。以下に例を示します。
dim myQuestion as NotesDocument
dim yourAnswer as NotesDocument
'...set value of yourAnswer...
set myQuestion = GetParentDocument( yourAnswer )