Note: When the user browses the data, it is unintentionally or intentional to modify the data, so when the data browsing is turned off, it is necessary to prompt whether the user saves the modification of the modification, which can generally write in the InteractiveChange event in each control that can be modified. Code, when this event is triggered, set a variable (such as iSEDIT) to logic .t., Then when you exit, you can prompt whether the operator is to be saved by determining the value of the variable. Because if the user does not make changes, it is a bit more than the prompt, so this prompt will look more friendly.
But if you write code for each of the InteractiveChange events of each editable control, it is a bit trouble, even if it is considered to be considered, it is not a good way, so the following method is for your reference.
Note: Use this method, you have to open the table with a buffer mode.
Isneedtosave = .f.
For gncount = 1 TO FCOUNT () && cycle number is equal to the number of fields
If GetFldState (Field (GNCOUNT))> = 2 && shows each field, see the getfldState () function
isneedtosave = .t.
Exit && When a field is modified, you will exit judgment
ENDIF
ENDFOR
IF isneedtosave
ANS = MessageBox (want to save your modification?, 3 32, inquiry)
Do Case
Case ANS = 6 && option is
= TableUpdate (.t.)
Case ANS = 7 &&
= TableRevert (.t.)
Case ANS = 2 && Selection Cancel
Endcase
ENDIF
It is recommended to write the above code in the queryunload event of the form.