Rgent - getting first docuemnt and update the parent

I have one main membership form. From here i will go to history form where there will more than one record for the particular member. My request is, when i edit only first record it should update two fields in the parent. if i edit other record it should not update. Please help me as i am new to lotus notes programming. For all records its going to Ist If statement, i.e not going main else.

Following is my code

Sub Queryopendocument(Source As Notesuiview, Continue As Variant)

Dim ws As New NotesUIWorkspace

Dim uidoc As notesuidocument

Dim docs As NotesDocumentCollection

Dim doc As NotesDocument

Dim flag As Boolean

Dim session As New NotesSession

Dim db As NotesDatabase

Set db = session.CurrentDatabase

Set docs = Source.Documents

Set doc = docs.GetFirstDocument

If Not (doc Is Nothing) Then

If doc.Form(0)=“Renewal” Then

flag = ws.DialogBox ( “Renewal”, True,True,False, True, False, False, “Edit Entry”,doc,False,False,True)

If cxEntryType=“Renew” Then Call uidoc.FieldSetText(“dxStart”,Cstr(Format(doc.dxstart(0),“mm/dd/yy”)))

Call uidoc.FieldSetText(“dxExpiry”,Cstr(Format(doc.dxExpiry(0),“mm/dd/yy”)))

Call doc.save(True,False)

Call uidoc.Save

Call ws.ViewRefresh

continue=False

endif

Else

If doc.Form(0)=“Renewal” Then

flag = ws.DialogBox ( “Renewal”, True,True,False, True, False, False, “Edit Entry”,doc,False,False,True)

End If

End If

End Sub

Subject: rgent - getting first docuemnt and update the parent

In the First IF Statement, you have given continue=False, remove that line.

Also remove the endif after continue=False.

Typically it should be like this

If cxEntryType=“Renew” Then

''Your Statements

elseif doc.Form(0)=“Renewal” then

''Your statements

End If.

Subject: RE: rgent - getting first docuemnt and update the parent

thanks for your reply mr.narashimha.

See I have two forms say form1 and form2(form1 belong 1.nsf database and form2 belongs to 2.nsf).

In form1 we have 100 employees. suppose i am accessing employee number 10 and going to form2 with the same employee where we will more than one record for employee number 10. In this case i must select only first record of the form2 for employee number 10 and update the form1 fields. if i edit other records it should not update anything. I hope u understood what i am asking…pls help me.

Subject: rgent - getting first docuemnt and update the parent

First, stop re-posting the same question…it doesn’t help and may even hurt.Second - don’t even get me started on ‘Urgent’…just stop!

Third, how do you know a child is ‘first’? When a child is opened, there must be one or more fields in the document that can be compared to the same fields in the other child docs to determine who’s first. Once you can explain this, you have a mechanism to decide when to update the parent and when not to update the parent.

You should NOT use ‘location in the view’ as ‘first’. You should be able to look at specific data in the children to make the determination.

HTH

Subject: RE: rgent - getting first docuemnt and update the parent

Thnaks Mr. Doug Finner for your kind reply.

As i told before say I have one main form i.e employee form(nsf 1). In the same form below we have history Form(nsf 2) (i.e parent child). For one employee say employee number 10 for main form we will have more than record for history form. When we edit history form it will open another srceen called renewal. When we edit only Ist record it should update the parent(some fields). When we edit other record it should update the same. I hope u got what i am asking. Pls do the need as i am new to Lotus notes.