This is a nice little script for a cancel button or action. I relied so much on this website to write it, it's only fair that I share it. When pressed, it presents a message box asking the user if they really want to cancel. "No" is the default selection, which returns them to the form. "Yes" closes the form without saving or prompting the user to save, and returns them to the selected view.
Be sure to include the SaveOptions and ToCancel fields in your form.
The the QuerySave entry is not always necessary, but may be used if you have other stuff or buttons going on to verify the cancel decision.
In the cancel button/action: Sub Click(Source As Button) Dim workspace As New NotesUIWorkspace Dim uidoc As NotesUIDocument Set uidoc = workspace.CurrentDocument Dim answer As Integer answer%=Messagebox ("You have made a request to quit. This action will_
void this entry form. Are you sure you want to do this?", 308, "Warning!") If (answer% = 7) Then Call uidoc.refresh Else Call uidoc.FieldSetText ("ToCancel", "Cancel") Call uidoc.FieldSetText ("SaveOptions", "0") Call uidoc.Close Call workspace.OpenFrameSet ("IViewSet") End If End Sub Then in your QuerySave event, put this: Sub Querysave(Source As Notesuidocument, _ Continue As Variant) If ( source.FieldGetText( "ToCancel" ) = "Cancel" ) Then continue = False End If End Sub