I’m running a local server/client environment w/ 6.5.1. I’m trying to copy a document and it’s responses from one database to another database on the same server. I also need to then copy the newly created documents/responses back to the first database (ping-ponging back and forth). Using .CopyToDatabase gives sporadic results - i.e. it works the first copy from a.nsf to b.nsf. However when going from b.nsf to a.nsf or the second time of a.nsf to b.nsf, the method creates the main document correctly but the responses end up on a different main document even though the docid of the new/second main document is being returned correctly. As you might be able to tell from the code below, I had to call .CopyToDatabase, get the unid and create a brand new notesdocument in order for the code to work.
WHY! WHY! WHY! WHY! WHY! WHY! WHY! WHY!
This has cost me a lot of time chasing what appears to be a bug not to mention the frustration.
Can someone tell me if I was doing something wrong? I did search this forum for similar posts but nothing appeared to be quite the same.
The commented code is what I had tried before and didn’t work.
Set docParentR1 = docParent.CopyToDatabase( db )
Print “copy…” & docParentR1.UniversalID
'Set docParentR = Nothing
Set docParentR = db.GetDocumentByUNID( docParentR1.universalid )
'Set vw = db.GetView( “pcnrevision” )
'Call vw.Refresh
'Set docParentR = vw.GetDocumentByKey( docParent.pcn(0) & Cstr( docParent.revision(0) ))
Print “lookup…” & docParentR.UniversalID
Set dc = docParent.Responses
If dc.count > 0 Then
…Set doc = dc.getfirstdocument
…While Not( doc Is Nothing )
…Set docChildR = doc.copytodatabase( db )
…Call docChildR.MakeResponse( docParentR )
…Call docChildR.Save(True, True, True )
…Set docChildR = Nothing
…Set doc = dc.getnextdocument( doc )
…Wend
End If