Sub Click(Source As Button)
On Error Goto ef
Dim session As New NotesSession
Dim dbNAB As NotesDatabase
Dim dc As NotesDocumentCollection
Dim doc As NotesDocument, docTemp As NotesDocument
Dim strSearch As String
Set dbNab = session.GetDatabase( "", "")
Call dbNab.Open( "", "names.nsf" )
strSearch = { ( form = "local" | form = "remote" ) & ( Destination = "TEST02.CN.ABB.COM/SRV/ABB" | Destination = "CN=TEST02.CN.ABB.COM//OU=SRV/O=ABB" ) }
Set dc = dbNAB.Search( strSearch, Nothing, 0 )
If dc.count > 0 Then
Set doc = dc.getfirstdocument
With doc
.Destination = "TEST02.CN.ABB.COM/SRV/ABB"
.LanPortName = "TCPIP"
.PortName = "TCPIP"
.OptionalNetworkAddress = "10.138.250.27"
.PhoneNumber = "10.138.250.27"
.Owner = session.username
.documentaccess = "[NetModifier]"
Call .computewithform( True, False )
Call .save( True, True )
Msgbox "Connection document has been updated"
End With
Set doc = dc.GetNextdocument( doc )
Do Until doc Is Nothing
Set docTemp = doc
Set doc = dc.GetNextdocument( doc )
Call docTemp.remove( True )
Loop
Else
Set doc = dbNab.CreateDocument
With doc
.form = "local"
.type = "Connection"
.connectionLocation = "*"
.connectionType = "0"
.Source = "*"
.Destination = "TEST02.CN.ABB.COM/SRV/ABB"
.LanPortName = "TCPIP"
.PortName = "TCPIP"
.OptionalNetworkAddress = "10.138.250.27"
.PhoneNumber = "10.138.250.27"
.Owner = session.username
.documentaccess = "[NetModifier]"
Call .computewithform( True, True )
Call .save( True, True )
End With
Msgbox "Connection document has been created"
End If
Exit Sub
ef:
Msgbox "error is" & Error$ & "”;and in line " & Erl, 16, "Error"
Exit Sub
End Sub
On Error Goto ef
Dim session As New NotesSession
Dim dbNAB As NotesDatabase
Dim dc As NotesDocumentCollection
Dim doc As NotesDocument, docTemp As NotesDocument
Dim strSearch As String
Set dbNab = session.GetDatabase( "", "")
Call dbNab.Open( "", "names.nsf" )
strSearch = { ( form = "local" | form = "remote" ) & ( Destination = "TEST02.CN.ABB.COM/SRV/ABB" | Destination = "CN=TEST02.CN.ABB.COM//OU=SRV/O=ABB" ) }
Set dc = dbNAB.Search( strSearch, Nothing, 0 )
If dc.count > 0 Then
Set doc = dc.getfirstdocument
With doc
.Destination = "TEST02.CN.ABB.COM/SRV/ABB"
.LanPortName = "TCPIP"
.PortName = "TCPIP"
.OptionalNetworkAddress = "10.138.250.27"
.PhoneNumber = "10.138.250.27"
.Owner = session.username
.documentaccess = "[NetModifier]"
Call .computewithform( True, False )
Call .save( True, True )
Msgbox "Connection document has been updated"
End With
Set doc = dc.GetNextdocument( doc )
Do Until doc Is Nothing
Set docTemp = doc
Set doc = dc.GetNextdocument( doc )
Call docTemp.remove( True )
Loop
Else
Set doc = dbNab.CreateDocument
With doc
.form = "local"
.type = "Connection"
.connectionLocation = "*"
.connectionType = "0"
.Source = "*"
.Destination = "TEST02.CN.ABB.COM/SRV/ABB"
.LanPortName = "TCPIP"
.PortName = "TCPIP"
.OptionalNetworkAddress = "10.138.250.27"
.PhoneNumber = "10.138.250.27"
.Owner = session.username
.documentaccess = "[NetModifier]"
Call .computewithform( True, True )
Call .save( True, True )
End With
Msgbox "Connection document has been created"
End If
Exit Sub
ef:
Msgbox "error is" & Error$ & "”;and in line " & Erl, 16, "Error"
Exit Sub
End Sub