[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Null value into an integer variable


On 19/4/24 8:23 pm, Rolf-Werner Eilert wrote:

Usually I try to catch this case by checking for "" and IsNull(Val(...)) like

If sMyString = "" Then
  iMyInteger = 0
Else
  If IsNull(Val(sOriginal)) Then
    iMyInteger = 0
  Else
    iMyInteger = Val(sOriginal)
  End If
End If

to be completely sure.

Regards
Rolf

The only problem with that is when the data is subsequently updated to the database it will be 0 instead of "not set yet". Further 0 may be an actual value for say "the account balance" when Null is the correct value at the time.

b


References:
GRIDVIEW color and size"Mayost Sharon" <sharon@xxxxxxxxx>
Re: GRIDVIEW color and sizeT Lee Davidson <t.lee.davidson@xxxxxxxxx>
Re: GRIDVIEW color and sizeT Lee Davidson <t.lee.davidson@xxxxxxxxx>
Re: GRIDVIEW color and size"Mayost Sharon" <sharon@xxxxxxxxx>
Re: GRIDVIEW color and sizeT Lee Davidson <t.lee.davidson@xxxxxxxxx>
Null value into an integer variable"Mayost Sharon" <sharon@xxxxxxxxx>
Re: Null value into an integer variableBB <adamnt42@xxxxxxxxx>
Re: Null value into an integer variableRolf-Werner Eilert <rwe-sse@xxxxxxxxxx>