DialogBox Issue

I have a multivalue field that is updated using a dialog box. It works fine except when you close the dialog box using the windows ‘X’ and the input field is left blank then it rewites the last record in the target field.

This is the code I am using.

FIELD WorkHistory := WorkHistory;

@Command([EditDocument];“1”);

x:= @DialogBox(“WorkHistoryNotes”; [AutoHorzFit] : [AutoVertFit] : [NoCancel] : [NoNewFields] ; “Work Description”);

@If(WorkHistoryNotes != “”;@SetField(“WorkHistory”; @If(WorkHistory = “”; “”; WorkHistory + @NewLine) +

@Text(@Today) + " " + @Left(@Text(@Time(@Now)); 5) + " " + @Right(@Text(@Time(@Now)); 2) + " - Work History (" + @Name([CN]; @UserName) + “): " + WorkHistoryNotes);”")

Please help…