Hello I am trying to return a recordset using VB Script. One of the fields I am getting back is type Decimal. By some reason VB Script does not automatically size variable to this type. So I am have to exlicetly define is as Double. The proble is, if this field returns as empty, I get a type mismatch error when I try to assign an emty field value to a Double. Is there a way arrond this problem?
The whole problem is that I can't do: vValue = objRS.Fields( <NameOrNumber> ).Value
vValue is not matching type with NULL if it is defined as Double. And if I don't define it as Double, I get upsupported type when I get the value back. The value coming back from the db is type decimal
probably I misunderstood you. I saw "VB Script", thought "VBScript" and wondered why you posted your question in this forum. Do you write VBA code in Excel or Access?
If so, try this
Dim vValue as Variant Dim dblValue as Double
vValue = objRS.Fields( <NameOrNumber> ).Value If IsNull( vValue ) Then dblValue = 0.0 Else dblvValue = CDbl( vValue )