'' increase DBH
Sub DBHPLUS
Dim objTheLayer, objTheForm, objEditFormCtrls, strDBH, aa, ub
Set objTheLayer = Application.Map.Layers.item(1)
Set objTheForm = objTheLayer.Forms(1)
Set objEditFormCtrls = objTheForm.Pages("PAGE1").Controls
If (objEditFormCtrls("txtDBH").value = "") Then
objEditFormCtrls("txtDBH").value = 1
Else
'get DBH string form form field
strDBH = objEditFormCtrls("txtDBH").value
'remove all spaces
strDBH
= Replace(strDBH,
" ",
"",
1,
-1) 'create array using comma delimeter
aa
= split (strDBH,
",",
-1,
1) 'get upper limit od array
'convert last entry to integer and add one
aa(ub)= 1 + cint(aa(ub))
'rebuild string from array adding commas
'pass new string to form field
objEditFormCtrls("txtDBH").value = strDBH
End If
'Free objects
set aa = nothing
set ub = nothing
set strDBH = Nothing
Set objEditFormCtrls = Nothing
Set objTheForm = Nothing
Set objTheLayer = Nothing
End Sub