Just a bit of nitpicking (once more)...
Be aware that your user can also close the form by clicking the 'X' in the top right conrner of your form.
Let's say, you want to give your user the option to Save or Cancel, it is better to make a Save method on your form than in the click event of your save button (actually this is the first rule I learned doing a VFP course some years ago, never put too much code in the click event of a command button... ;-) ).
In this case you could do something like:
cmdSave.Click
THISFORM.SAVE()
And when your user clicks on the X
Form.QueryUnload
If MessageBox('Save Changes?', 48) == 6
THISFORM.Save()
RETURN DODEFAULT()
ELSE
NODEFAULT
ENDIF
The 48 should be Yes, No , Cancel (I could remember the exact number ;-) )
HTH,
Weedz (Wietze Veld)
They cling emotionally to code and fix development rather than choosing practices based on analytical assesments of what works best. - Steve McConnell