Connection document

HiI need some assistance in modifying a script. I have a button with the following code to add a connection document

Sub Click(Source As Button)

Dim workspace As New notesUIworkspace 

Dim uidoc As notesuidocument     

Dim  db As New notesdatabase("","")

Call workspace.OpenDatabase("","names.nsf","Advanced\Connections")

Set uidoc =  workspace.ComposeDocument("","names.nsf","Server Connection")

Call uidoc.GoToField("Destination") 

Call uidoc.InsertText("D00001/Company")

Call uidoc.FieldSetText("ConnectionType","Local Area Network")

Call uidoc.REFRESH

Call uidoc.FieldSetText("LanPortName","TCPIP")

Call uidoc.REFRESH

Call uidoc.ExpandAllSections

Call uidoc.FieldSetText("OptionalNetworkAddress","x.y.x.a:15352")        

Call uidoc.save

Call uidoc.close

End Sub

All i want to do is, that instead of adding a new connection document for D0000/Company, i just want to edit the existing Connection document, and modify the OptionalNetworkAddress field.

I am pretty new at scripting, so any help will be appreciated.

Subject: Connection document

Try this code:

Dim session As New NotesSession

Dim db As NotesDatabase

Set db = session.getDatabase(“names.nsf”)

Dim view As NotesView

Dim doc As NotesDocument

Set view = db.getView(“Advanced\Connections”)

Set doc = view.getDocumentByKey(“D00001/Company”)

doc.OptionalNetworkAddress = “x.y.x.a:15352”

Call doc.Save(true, false)

Regards

Litty Joseph

Subject: RE: Connection document

ThanksThis code works, but it doesnt refresh the view unless we go in the document, open it and save and close it.

I also tried Call view.refresh but it shows the old entry, but once we go inside it shows the change.