Hi Everyone,
I have a form which has a “Retired” button. When a user selects this button I am wanting the status of that document to be set to “Retired”, but also at the same time I’m wanting it to check a view for any documents which have the same RegMark (Registration) as the current document and to set that/those status to Retired as well.
The only other thing I need to take into account is a field called RegMark_1. RegMark or RegMark_1 will have a value on this particular document where the Reject button is. But… on the other documents, held in the view, the field will only be called RegMark.
Can anyone help? I think I’ve gone down the wrong road, by using GetDocumentByKey ? I’m not sure.
Thanks in advance
Hayley.
Here is the code:
Sub Click(Source As Button)
Dim session As New NotesSession
Dim db As NotesDatabase
Dim ws As New NotesUIWorkspace
Dim doc As NotesDocument
Dim uidoc As NotesUIDocument
Dim view As NotesView
Dim vehicledoc As NotesDocument
Set db=session.CurrentDatabase
Set uidoc = ws.CurrentDocument
Set doc=uidoc.Document
Set view=db.GetView(".vwRVMCF")
uidoc.EditMode = True
If uidoc.FieldGetText( "RegMark" ) <> "" Then
Set vehicledoc=view.GetDocumentByKey(doc.RegMark(0),True)
Call vehicledoc.FieldSetText("Status", "Retired")
Else
RMark1 = uidoc.FieldGetText("RegMark_1")
Call uidoc.FieldSetText("RegMark", "RMark1")
Set vehicledoc=view.GetDocumentByKey(doc.RegMark(0),True)
Call vehicledoc.FieldSetText("Status", "Retired")
End If
Call uidoc.FieldSetText("Status", "Retired")
Call uidoc.Save
Call uidoc.Close
End Sub