I use a custom edit-form. It is possible that some controls become invisible during the user enters data. If this happens, I want the script to set the values of these controls to zero.
Here is my idea:
Sub CheckFeatureValues
Dim thisPage
Set thisPage = Map.Layers("A").Forms("EDITFORM").Pages("A")
If Not thisPage.Controls("txtWidth").Visible Then
thisPage.Controls("txtWidth").Value = ""
End If
End Sub
I call this sub when the OnValidate-Event of the Form-Page "A" is fired. If I check the value of the control with a MsgBox ("MsgBox thisPage.Controls("txtWidth").Value"), the value is correctly set to "". But in spite of that the OLD value of the control is saved to the database.
I do not know if this could be the problem but you can only set values for controls on a page that is active. If Map.Layers("A").Forms("EDITFORM").Pages("A") is not active, the result of the thisPage.Controls("txtWidth").Value = "" is not reliable.