Problem in child form link

I have a form “SAP Form”.On that form , I have a button “Create Blueprint”. Code behind this button is :


Sub Click(Source As Button)

Dim w As New NotesUIWorkspace

Dim session As New NotesSession	

Dim db As NotesDatabase

Dim view As NotesView	

Dim vc As NotesViewEntryCollection

Dim uidoc As NotesUIDocument

Dim doc As NotesDocument

Dim counterdoc As NotesDocument

Dim itemA As NotesItem

Dim notesForm As NotesForm

Dim doc1 As  Notesdocument

Dim i As Integer



Set db = session.CurrentDatabase	

Set uidoc = w.CurrentDocument

Set doc = uiDoc.Document

Set doc1 = db.CreateDocument



Call doc.Save(False, True)	

Call w.ComposeDocument( "", "", "Blueprint Form" )





savcheck=1

Call uidoc.Save

unid = doc.UniversalID

doc.SaveOptions = "0"



Call doc.Save(False, True)	



Call uidoc.close

End Sub


on that child form , user enter some values and and press “Attach”,an action on the child form.Code behind this action is :


Sub Click(Source As Button)

Dim uidoc As NotesUIDocument

Dim ws As New NotesUIWorkspace

Dim sess As New NotesSession

Dim db As NotesDatabase

Dim thisdoc As NotesDocument

Dim parentdoc As NotesDocument

Dim rtitem As NotesRichTextItem



Set uidoc = ws.CurrentDocument

Set db = sess.CurrentDatabase

Set thisdoc = ws.CurrentDocument.Document



Call uidoc.FieldSetText("rwfdocstatus" , "Request Closed")



Call thisdoc.Save(True,True,True)

Call ws.CurrentDocument.Save

Set parentdoc = db.GetDocumentByUNID( thisdoc.ParentDocumentUNID )



Set rtitem = parentdoc.GetFirstItem("fd_bluelink")

Call rtitem.AppendDocLink( thisdoc, "Link To ABAP" )

parentdoc.x_fd_blueatt="1"



Call parentdoc.Save(True,True,True)

v_savecheck = 1

Call uidoc.Save

Call uidoc.close





Call ws.EditDocument(False, parentdoc)

End Sub


The problem is that the field “fd_bluelink” initially contains the link of the child doc “Blue print” but after some time , it becomes the link of the database. :(.

I have tried a lot to sought out that why this happens but of no use.

Any tips??

Regards,

Aisha Ishrat.