>I do not have a SAVE function in my form. I have trained my users that when they make an edit, its a done deal, so be careful. (I know, not very elegant but I was a beginner when I wrote it.) If I read the HELP correctly, if I use optimistic record locks (buffer mode 3) VFP will automatically update the table whenever the record pointer is moved without an explicit call to tableupdate. If that's true it would seem a good way to go. Then I would only have to worry about a form close and maybe do a SKIP in the form.destroy. Any thoughts?
You should check if there are changes, and ask the user whether he wants to change (Yes/No/Cancel) under the following circumstances:
User clicks on next record, previous record, first record, last record. You would have form methods for each of those cases.
User tries to close the form. Intercept in Form.QueryUnload(); NODEFAULT will avoid closing the form.
Of course, the user can also press the SAVE button; in this case, the changes might be saved immediately, without asking.
A normal editing form might have the following methods for this functionality; of course, the method names may vary:
Next()
Previous()
LastRecord()
FirstRecord()
Cancel()
Save()
MayMove() - this is supposed be invoked from Next(), etc., and from QueryUnload(), checks whether there are changes, and if there are, asks the user whether he wants to save the changes.
PendingChanges() - checks whether there are pending changes in the current record. Use function GetFldState(-1).
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)