Hi to all of you,
I have a little problem!
I have some code that is placed on a button on a document, I have to change it so I can place it on a view and it will change all documents where the field modem_a is empty and it will insert the values from another document over the UNID!
I dont know how to go trough the view check the values and how to insert the matching value!
Here is the code that works on a document!
Thank you in advance
Sub Click(Source As Button)
Dim ws As New NotesUIWorkspace
Dim s As New NotesSession
Dim tempdoc As NotesDocument
Dim uidoc As NotesUIDocument
Dim mbr As Variant
Dim naziv As String
Dim paket As String
Dim placanje As String
Dim modem As String
Dim view As NotesView
Set db = s.CurrentDatabase
Set uidoc = ws.CurrentDocument
'Set newdoc = uidoc.Document
mbr = uidoc.FieldGetText("jmbg")
naziv = uidoc.FieldGetText("organizacija")
Set View = db.GetView("UgovoriBroj") ' view iz kojeg se izvlače podaci
' sortirano po UNID dokumenta
' UNID tekućeg dokumenta
Set tempdoc = view.GetDocumentByKey(mbr,True)
' ako dokument ne postoji unutar baze ne nastavlja se sa daljnjim slanjem obavijesti
If (tempdoc Is Nothing) Then
Msgbox "Ugovor nije pronadjen u bazi ", 0+16,"Greška"
Exit Sub
End If
brugovor = tempdoc.ugovor_broj(0)
paket = tempdoc.paket(0)
placanje = tempdoc.placanje(0)
modem = Cstr(tempdoc.modem(0))
Call uidoc.FieldSetText("ug_broj", brugovor)
Call uidoc.FieldSetText("modem_1",Cstr(modem))
If uidoc.FieldGetText("VrstaDokumenta") = "Priključak na Internet" Then
Call uidoc.FieldSetText("paket", paket)
Call uidoc.FieldSetText("placanje", placanje)
End If
Call uidoc.Refresh
End Sub