NotesUIDocument Save Cancelled

I have created an action button ‘Save’ and from code i have called uidoc.saveFollowing is the code in QuerySave event

Sub Querysave(Source As Notesuidocument, Continue As Variant)

If Cstr(uidoc.FieldGetText(“Subject”)) =“” Then

	Messagebox "Subject Empty!"

                            Continue = False		

End If

End Sub

Error ‘NotesUIDocument: Save Cancelled’ is generated

Subject: NotesUIDocument Save Cancelled

R you doing this in Memo form in Mail file…

Subject: NotesUIDocument Save Cancelled

You need to add the below in your action button. It will supress the Error message.

On Error 4411 Resume Next

Subject: RE: NotesUIDocument Save Cancelled

Martin,

on writing

On Error 4411 Resume Next

executes the code written on action button. If process of saving fails then the code of action button should not be executed.

I created a label named Finish and tried

On Error 4411 Goto Finish

but it gave error ‘No RESUME’

Subject: RE: NotesUIDocument Save Cancelled

Sorry, try something like this…

Sub Click

On Error Goto errorhandler

(any other code…)

Call uidoc.Save

(any other code…)

quit:

Exit Sub

errorhandler:

If Err=4411 Then ' Save cancelled via continue = false so supress error report

	Resume quit

Else

	Msgbox Error(Err)

	Resume quit 

End If

End Sub

Subject: RE: NotesUIDocument Save Cancelled

Great!

Yes, it worked. Code executed according to the requirements and the error was supressed.

Thanks

Ajay Chawla