J
John
I am trying to easily convert a string into a number. The string uses a
trailing "-" to indicate a negitive number. What I currently have is:
Dim MyNum as Single
Dim RawNum as String
RawNum = "The value we need is 654,169- and it is neg."
MyNum = Val(Mid(RawNum, 21, 8)) * IIf(Mid(RawRec, 29, 1) = "-", -1, 1)
My concern is that if a number on the report gets off by just one digit, my
code falls apart. Is there a better way to deal with this?
trailing "-" to indicate a negitive number. What I currently have is:
Dim MyNum as Single
Dim RawNum as String
RawNum = "The value we need is 654,169- and it is neg."
MyNum = Val(Mid(RawNum, 21, 8)) * IIf(Mid(RawRec, 29, 1) = "-", -1, 1)
My concern is that if a number on the report gets off by just one digit, my
code falls apart. Is there a better way to deal with this?