kstoneman10
Member
- Joined
- Feb 20, 2010
- Messages
- 11
- Programming Experience
- 3-5
I'm trying to convert a process a former employee wrote to new process. The old process updates information row by row. I want to change it to a DataArray. My problem is I can't figure out how to change the line that involves the IsDBNull function.
Here is the original code:
If IsDBNull(rs3("NCO")) = True Then xlWorkBook.ActiveSheet.Cells(t + 9, lobcol + 14) = 0 Else xlWorkBook.ActiveSheet.Cells(t + 9, lobcol + 14) = FormatNumber(((rs3("NCO") - rs3("NCH2")) / rs3("NCO")), 2)
This is what I'm attempting to change it to:
DataArray(r, 14) = If(IsDBNull(rs3("NCO")), 0, FormatNumber(((rs3("NCO") - rs3("NCH2")) / rs3("NCO")), 2))
Right now I'm getting an error message "Cannot infer a common type for the second and third operands of the 'If' operator. One must have a widening conversion to the other"
Any ideas would be greatly appreciated.
Kevin
Here is the original code:
If IsDBNull(rs3("NCO")) = True Then xlWorkBook.ActiveSheet.Cells(t + 9, lobcol + 14) = 0 Else xlWorkBook.ActiveSheet.Cells(t + 9, lobcol + 14) = FormatNumber(((rs3("NCO") - rs3("NCH2")) / rs3("NCO")), 2)
This is what I'm attempting to change it to:
DataArray(r, 14) = If(IsDBNull(rs3("NCO")), 0, FormatNumber(((rs3("NCO") - rs3("NCH2")) / rs3("NCO")), 2))
Right now I'm getting an error message "Cannot infer a common type for the second and third operands of the 'If' operator. One must have a widening conversion to the other"
Any ideas would be greatly appreciated.
Kevin