I have a modal dialog box called on a document in an embedded view from the view’s Queryopendocument:
Call workspace.DialogBox (“StatusEntry”, True, True, True, True, False, False, “New Status Entry”, doc, True,True,True)
I am trying to create a warning if the user makes changes in the dialog box and tries to leave without clicking Save. I need to prevent them from clicking Close (without Saving) or hitting Escape, so I use the Queryclose event like this:
Close button
Dim ws As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Set uidoc = ws.CurrentDocument
uidoc.close
Queryclose
Dim ws As New NotesUIWorkspace
‘Note: wasChanged is set in fields’ onChange event to True, else it’s False.
If wasChanged Then
If ws.Prompt(PROMPT_YESNO, “Close without Saving?”, “”) = 0 Then
Continue = False
End If
End If
If the user clicks “Close”, then changes their mind and clicks “No” in the Prompt box, then changes their mind back and clicks “Close” again, I get the message NotesUIDocument object is no longer valid
How could that possibly be? I get the same problem if I make uidoc global and set it in the form’s Postopen event with Set uidoc = Source.
What could be wrong here?
Thanks,
-Jeff