Changes in the tree aren't saved
A node renamed, moved, added, or deleted in Form view, or a cell edited in a tree list, looks
changed in the control, but the table hasn't changed, and the change is gone after Requery or
after the form is reopened.
Environment
All versions of WklTreeView and WklTreeList.
Cause
One of the following applies:
AutoSaveis False, so changes affect only the display. A cell is then editable regardless of what the source allows, and the entered value stays on screen untilRequeryreads the source again.ValidateCelloccurs before the value is accepted (withCancel), andAfterCellUpdateoccurs after it (withoutCancel). An application that writes the change itself (with a stored procedure, for example) does so inValidateCelland cancels if the write fails, becauseAfterCellUpdatecan no longer undo the display; values that the write changes elsewhere (a row version or a timestamp) appear afterRequery.- The tree was loaded from a
Recordsetor withLoadFromFile,LoadFromStream,LoadFromString, orAsJSONwithout aRecordSource, so there's no record source to write to. BeforeUpdate(orAfterLabelEdit,NodeDrop, orValidateCell) setCancel = True, and the whole operation was rolled back.- Access rejected the write (a validation rule, a required field, or a locked or read-only source such as a query that can't be updated). The tree then stays unchanged, and
DataErrorreports the reason.
Resolution
- Check
AutoSave(property sheet, Other tab). - Bind with
RecordSourceinstead ofRecordsetif changes must be saved. Handle
DataErrorto see the Access error message:Private Sub Tree1_DataError(ByVal DataErr As Long, ByVal Description As String, Response As Integer) Debug.Print DataErr, Description End Sub- Make sure the record source can be updated: open it in Datasheet view and change the same field by hand.
en/wiki/msaccess/comctl/troubleshooting/changes-not-saved.txt · Last modified: by Wolfgang van der Stille