Subtracting two numbers in vbscript on a form

2826
3
07-14-2010 07:57 AM
JamesIreland
New Contributor
Hello,

I have attached two pics of my login form.
The "working login form.jpg" shows:
Starting Mileage = 88, Ending Mileage = 92, Total Mileage = 4
So EndingMileage (92) - Starting Mileage (88) = Total Mileage (4)
This works fine.

The "nonworking login form.jpg" shows:
Starting Mileage = 99, Ending Mileage = 105, Total Mileage = 0
So EndingMileage (105) - Starting Mileage (99) = Total Mileage (0)
This does NOT work.

Please help.  Either vbscript or arcpad 7.1.1 thinks that the first number in
Starting Mileage (9) in the 99 value is greater than the first number in
Ending Mileage (1) in the 105 value????

I can get this formula to work if I add a 0 in front of the 99 in Starting Mileage.... so this works
Ending Mileage (105) - Starting Mileage (099) = 6, but I don't want my users
to have to put a 0 in front of a number if it was 99 miles, and then there speedometer goes
to 105 miles.....

How can I get around this issue??? Is there some script I can write in vbscript?

thank you
James Ireland
GIS Technician
Tags (4)
0 Kudos
3 Replies
Almarde_Ronde
New Contributor
Just tried it out myself using a custom applet and all works well. I attached the applet, so you can see if it works for you.
0 Kudos
by Anonymous User
Not applicable
Original User: coriba

I am not sure of the cause, seems funny.  did you try casting the values?

result = cint(objctl1.value)-cint(objctl2.value)
0 Kudos
JamesIreland
New Contributor
yes I tried putting cInt and they didn't work either.
I forgot to mention I am using a form in a system folder
on the Arpad.apx  & Arcpad.vbs
I have attached my code, not sure if it will work for you to test, but here it is:

James Ireland
0 Kudos