Cheers Fabio,
It seems like what I need to do is to have all my form based controls raise a form based property that indicates that a valid event has raised a problem and prevent the form from closing ;
something like
form.Txt_Name.Valid
If empty(this.value)
messagebox('Name cannot be blank')
thisform.lValidationBroken = .T.
else
thisform.lValidationBroken = .F.
endif
And then on the queryunload event have code something like this ;
If lValidationBroken
NoDefault
Return .F.
Endif
I suppose one of the problems here is that we have row level validation that occurs and form based validation.
The row based validation only fires when the user has changed a value in a grid control, if they then want to close the form with the X, we need to validate the entries before asking them if they want to save.
I suppose the same thing could be achieve by using form based validation and calling that from the save method.
Any thoughts anybody?
Thanks, Bernard