GetResultAccess always returns Nothing?

To all

I have copied a function from the NX provided examples as it should be doing exactly what I want (don't want to re-invent the wheel!). I need to access some results (VonMises Stress). I have pasted the function at the end of the query.

Establishing the results seems to be working OK and I am assuming that I do have a valid Dim results As CAE.Result = GetResults(theTargetSolution) returned i.e. it's not the problem

My test have 1 load case (therefore ID = 0) and a number of iteration (I am testing with IterID=1)
I am calling the function using

Dim iIterID As Integer = 1
Dim theAccessedResult As CAE.ResultAccess = GetResultAccess(results,0,iIterID,1.0)

Does anyone know
1. is there anything wrong in function GetResultAccess()?
2. if nothing obvious is there a way of testing where the issue is?

Thanks
Regards

Function GetResultAccess(ByRef results As CAE.Result, _
ByVal loadCaseIdx As Integer, _
ByVal iterationIdx As Integer, _
ByVal scale As Double) As CAE.ResultAccess

Dim part As BasePart = theSession.Parts.BaseWork

Dim theResultManager As CAE.ResultManager = theSession.ResultManager()

If (theResultManager Is Nothing) Then
theNXMessageBox.Show(theNXMessageBoxTitle, NXMessageBox.DialogType.Error, "No valid ResultManager")
Return Nothing
End If

Dim unit_stress As Unit = Nothing

If part.PartUnits() = BasePart.Units.Millimeters Then
unit_stress = CType(part.UnitCollection.FindObject("MilliNewtonPerSquareMilliMeter"), Unit)
Else
unit_stress = CType(part.UnitCollection.FindObject("PoundForcePerSquareInch"), Unit)
End If

Dim resultParameter As CAE.ResultParameters = theResultManager.CreateResultParameters()

Dim resultType As CAE.Result.Type
resultType.Quantity = CAE.Result.Quantity.VonMisesStress
resultType.Location = CAE.Result.Location.ElementNodal
resultType.Section = CAE.Result.Section.NotApplicable

Dim averaging As CAE.Result.Averaging
averaging.DoAveraging = False
averaging.AverageAcrossPropertyIds = False
averaging.AverageAcrossMaterialIds = False
averaging.AverageAcrossElementTypes = False
averaging.AverageAcrossFeatangle = False
averaging.AverageAcrossAnglevalue = 45.0
averaging.IncludeInternalElementContributions = True

resultParameter.SetLoadcaseIteration(loadCaseIdx, iterationIdx)
resultParameter.SetResultType(resultType)

resultParameter.SetResultComponent(CAE.Result.Component.Magnitude)
resultParameter.SetSectionPlyLayer(0, 0, 0)
resultParameter.SetAveragingCriteria(averaging)
resultParameter.SetCoordinateSystem(CAE.Result.CoordinateSystem.AbsoluteRectangular)
resultParameter.SetElementValueCriterion(CAE.Result.ElementValueCriterion.Average)
resultParameter.SetComplexCriterion(CAE.Result.Complex.Amplitude)
resultParameter.SetPhaseAngle(0.0)
resultParameter.SetScale(scale)
resultParameter.SetUnit(unit_stress)

Dim solResultsAccess As CAE.ResultAccess
Try
solResultsAccess = theResultManager.CreateResultAccess(results, resultParameter)
solResultsAccess.SetParameters(resultParameter)
Return solResultsAccess
Catch ex As Exception
Return Nothing
End Try

End Function