Copy document with responses to another database

Hello all:Is there a way to copy a document with responses from one database to another database without losing it’s responses

Thanks in advance

Dalia

Subject: copy document with responses to another database

Extract from the help:

These two scripts work together to place the currently open document (in the user interface) and its responses, including all responses-to-responses, in a folder. The first script is a form action script that the user can activate from a document on the workspace. It gets doc, the document on disk that corresponds to the currently open document, and places it in a folder of the user’s choice. It then calls the PutAllResponsesInFolder sub.

Sub Click(Source As Button)

Dim workspace As New NotesUIWorkspace

Dim uidoc As NotesUIDocument

Dim doc As NotesDocument

Dim choice As String

Set uidoc = workspace.CurrentDocument

Set doc = uidoc.Document

choice = Inputbox( “Please enter a folder name:”, _

“Which folder?” )

Call doc.PutInFolder( choice )

Call PutAllResponsesInFolder( doc, choice )

End Sub

The PutAllResponsesInFolder sub takes a parent document and a folder name, and places the responses and responses-to-responses of the parent document into the specified folder. The sub places each response to the parent document into the specified folder. For each response, the sub calls itself to place any responses to the response into the folder. This recursive behavior allows you to access every descendant of the parent document, no matter how many levels deep it is nested. If there are no responses, the sub exits.

Sub PutAllResponsesInFolder _

( doc As NotesDocument, folderName As String )

Dim collection As NotesDocumentCollection

Dim currentResponse As NotesDocument

Set collection = doc.Responses

Set currentResponse = collection.GetFirstDocument

’ Put immediate responses to doc into the folder

’ If there are none, sub exits and returns to calling sub

While Not ( currentResponse Is Nothing )

Call currentResponse.PutInFolder( folderName )

' Recursive call to put immediate responses to 

' currentResponse in folder

Call PutAllResponsesInFolder _

( currentResponse, folderName )

Set currentResponse = collection.GetNextDocument _

( currentResponse )

Wend

End Sub

Instead of using the ‘put in folder’ you could modify this part to copy to database instead.

HTH,

Ranjan

Subject: RE: copy document with responses to another database

Thanks Ranjan,you are a great help,what I need to do is run a schedualed agent to move documents and their responses from one db to another based on a criteria in the document(some sort of a hand made archiving system)

thanks again

dalia