I am trying to use ArcPad 10 for an upcoming river inventory. Created a form for collecting data, but would also like to use some of this data to perform some calculations and return it to the data collector. I think I am getting close with the VBS script, but it is not returning data yet. May have something to do with event management on the form pages. Any help would be appreciated......Tom
Public Sub CalcValues()
'declare variables to be used
Dim el1, el2, el3, el4, el5, el6, el7, el8, el9, el10, el11, el12, el13, el14, el15, el16, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, scoreA, scoreB, calc
'set variables to form's page's controls
Set el1 = EDITFORM.Pages.Item("page4").Controls.Item("element1")
Set el2 = EDITFORM.Pages.Item("page4").Controls.Item("element2")
Set el3 = EDITFORM.Pages.Item("page4").Controls.Item("element3")
Set el4 = EDITFORM.Pages.Item("page4").Controls.Item("element4")
Set el5 = EDITFORM.Pages.Item("page4").Controls.Item("element5")
Set el6 = EDITFORM.Pages.Item("page4").Controls.Item("element6")
Set el7 = EDITFORM.Pages.Item("page4").Controls.Item("element7")
Set el8 = EDITFORM.Pages.Item("page4").Controls.Item("element8")
Set el9 = EDITFORM.Pages.Item("page5").Controls.Item("element9")
Set el10 = EDITFORM.Pages.Item("page5").Controls.Item("element10")
Set el11 = EDITFORM.Pages.Item("page5").Controls.Item("element11")
Set el12 = EDITFORM.Pages.Item("page5").Controls.Item("element12")
Set el13 = EDITFORM.Pages.Item("page5").Controls.Item("element13")
Set el14 = EDITFORM.Pages.Item("page5").Controls.Item("element14")
Set el15 = EDITFORM.Pages.Item("page5").Controls.Item("element15")
Set el16 = EDITFORM.Pages.Item("page5").Controls.Item("element16")
For Counter = 1 To 16
If el(Counter.value) = Null Then
c(Counter.value) = 0
Else
c(Counter.value) = 1
End If
Next
'do math
scoreA.Value = el1.Value + el2.Value + el3.Value + el4.Value + el5.Value + el6.Value + el7.Value + el8.Value + e9.Value + el10.Value + el11.Value + el12.Value + el13.Value + el14.Value + el15.Value + el16.Value
scoreB.Value = c1.Value + c2.Value + c3.Value + c4.Value + c5.Value + c6.Value + c7.Value + c8.Value + c9.Value + c10.Value + c11.Value + c12.Value + c13.Value + c14.Value + c15.Value + c16.Value
calc.Value = CDbl(scoreA.Value) / CDbl(scoreB.Value)
'vbscript assumes these are strings and appends them, to get the sum like you want cast them to a double (CDbl) or integer (CInt)
Set scoreA = EDITFORM.Pages.Item("Results").Controls.Item("scoreA")
Set scoreB = EDITFORM.Pages.Item("Results").Controls.Item("scoreB")
Set calc = EDITFORM.Pages.Item("Results").Controls.Item("calc")
End Sub