Hi I've got this piece of code in a procedure for calculating IRRs from a table of data and at first it was snagging when it came to a null value, so I put in an if to tell it to take a zero if the field is null, but it still seems to snag on it, when I look in the code it has set it to zero but it still halted the process.
Here is the bit of code:
If rec.Fields(Counter + 5) = Null Then
Values(Counter) = "0"
Else
Values(Counter) = rec.Fields(Counter + 5)
End If
It's the bit:
Values(Counter) = rec.Fields(Counter + 5)
that is highlighted when I look into the VB and when I hover over the Values(Counter) it says it is 0, so it seems like the if is working?
I have tried putting a zero into the field on the table and it works then so it can't be that it has a problem with the value 0? But I can't go through the table looking for all the nulls and replacing them as it is all automated.
I'm really stumped?
Here is the bit of code:
If rec.Fields(Counter + 5) = Null Then
Values(Counter) = "0"
Else
Values(Counter) = rec.Fields(Counter + 5)
End If
It's the bit:
Values(Counter) = rec.Fields(Counter + 5)
that is highlighted when I look into the VB and when I hover over the Values(Counter) it says it is 0, so it seems like the if is working?
I have tried putting a zero into the field on the table and it works then so it can't be that it has a problem with the value 0? But I can't go through the table looking for all the nulls and replacing them as it is all automated.
I'm really stumped?
Last edited: