Hide when open on editing

When I click on this action button from a view, it changes the status to “Stolen”…but at the same time I also want to update the history field.

@If(@IsDocBeingEdited; @True;@Command( [EditDocument] ; 1 ));

@If(Form=“Computer”;FIELD ComputerStatus:=“Stolen”;Form=“Mobile”;FIELD MobileStatus:=“Stolen”;form=“Software”;FIELD SoftwareStatus:=“Stolen”;form=“AirCard”;FIELD AirCardStatus:=“Stolen”;Form=“Camera”;FIELD CameraStatus:=“Stolen”;“”);

@Command([FileCloseWindow])

So, I used this script using the Onchange, On exiting and On entering event

Dim session As New NotesSession

Dim ws As New NotesUIWorkspace

Dim db As NotesDatabase

Dim docx As NotesDocument

Dim uidoc As NotesUIDocument

Dim hitem As NotesItem

Dim statusitem As notesitem

Dim hstring As String

Dim unid As String

Set db = session.CurrentDatabase

Set uidoc = ws.CurrentDocument

Set docx= uidoc.Document

Set hitem=docx.GetFirstItem(HistoryField)

Set statusitem=docx.GetFirstItem(StatusField)

uidoc.EditMode=“True”

Call hitem.AppendToTextList(hstring)

Call uidoc.Save

The above two codes works perfectly but when I turned hide when open on editing on the Status field, it does not work. Why?