VBScript - Cannot add values?
Hi Guys, I am attempting to add two values together just like this:
However, instead of these values adding together, they are concatenating.. I am unsure as to why, as I double checked the VBScript 'Addition' uses '+' and the Concatenation uses '&'..
Here is the process:
End Result:
I would expect 548 (1 + 547).
-
Although the values are numeric the VB is thinking they are text and so is concatenating the fields together. If you add CInt(......) to both strings then that will then work
ie Value = CInt(Format.NamedSubStrings("TotalOrder").Value) + CInt(Field....<etc>....)
0 -
Thanks Peter Thane,
I used your method and ran into an overflow error, however I fixed it by using 'CLng' instead of 'CInt'
Thanks Again.
0
Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.
Kommentare
2 Kommentare