Why does SSRS start displaying #Error in a field when I change page, but works fine initially?

284 views Asked by At

Odd one.

I have a report which basically returns a list of staff absences - there's a row per continuous period of absence listing the dates, number of days the absence lasted and then finally a column which displays the number of absences.

The report works fine initially displaying everything as I would expect, as below:

However, if I change to the second page the Occasions column stops displaying the figures and displays #Error instead. If I then change back to page 1 it continues to show #Error even though it was working perfectly when the report rendered:

Likewise, if I export to Excel it displays #Value instead of the data. The Occasions column is simply =Code.GetNumAbsences(Fields!Staff_Code.Value). The custom code that it's calling is...

Public Function GetNumAbsences(ByVal staffCode As String) As Integer

    Return CInt(MyTable(staffCode)(3)) 

End Function

MyTable is just a HashTable with a string (staffCode) as the Key, and the 3rd item is just an Integer. I have no idea why the report would suddenly throw an error after changing page when it works fine at runtime. Can anyone shed any light on this?

0

There are 0 answers