Color scheme: Light
You are here: start » en » Documentation » Microsoft Access development tools » WKL Forms Object Library » WKL Forms Object Library troubleshooting » Changes in the tree aren't saved

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:

  • AutoSave is 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 until Requery reads the source again. ValidateCell occurs before the value is accepted (with Cancel), and AfterCellUpdate occurs after it (without Cancel). An application that writes the change itself (with a stored procedure, for example) does so in ValidateCell and cancels if the write fails, because AfterCellUpdate can no longer undo the display; values that the write changes elsewhere (a row version or a timestamp) appear after Requery.
  • The tree was loaded from a Recordset or with LoadFromFile, LoadFromStream, LoadFromString, or AsJSON without a RecordSource, so there's no record source to write to.
  • BeforeUpdate (or AfterLabelEdit, NodeDrop, or ValidateCell) set Cancel = 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 DataError reports the reason.

Resolution

  1. Check AutoSave (property sheet, Other tab).
  2. Bind with RecordSource instead of Recordset if changes must be saved.
  3. Handle DataError to 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
  4. 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