Now to the issue. I have a class that I am trying to apply a value to one of its properties.
Expand|Select|Wrap|Line Numbers
- ...
- Streams.Item(rsName!Description).HInput = STMPTH(rs!P, rs!T)
- ...
- <in class>
- Property Let HInput(HInput As Double) 'Set the Enthalpy Input Value
- pHInput = HInput
- pH = pHInput
- End Property
There are over 100 items in the Streams collection and only 2 throw an over flow error at the first line of code I have put up here. Now, before you ask, I do not have access to the code of the STMPTH() method (it's in a DLL file that my company did not create). However, I know the method does work. When the overflow error is thrown, the compiler stops on that line:
Expand|Select|Wrap|Line Numbers
- Streams.Item(rsName!Description).HInput = STMPTH(rs!P, rs!T)
This is far from the first time I encountered this "phenomena" and have worked around it previously by catching the error and retrying the calculation (which worked. Example:
Expand|Select|Wrap|Line Numbers
- Property Get H() As Double 'Return Enthalpy of Stream
- H = 0
- On Error GoTo HErr
- If pSameAs = "" Then
- If pH <= 0 Then 'Enthalpy Not Known
- If pT > 0# And pP > 0# Then 'Calculate From Pressure and Temperature
- pH = STMPTH(pP, pT)
- ElseIf pT > 0# Then
- If pType = STREAMTYPE.Water Then
- pH = STMTQH(pT, 0#)
- End If
- ElseIf pP > 0# Then
- If pType = STREAMTYPE.Water Then
- pH = STMPQH(pP, 0#)
- End If
- End If
- End If
- Else
- pH = Streams(pSameAs).H
- End If
- H = pH
- GoTo HExit
- HErr:
- H = 0
- pT = pT
- pP = pP
- If pSameAs = "" Then
- If pH <= 0 Then 'Enthalpy Not Known
- If pT > 0# And pP > 0# Then 'Calculate From Pressure and Temperature
- pH = STMPTH(pP, pT)
- ElseIf pT > 0# Then
- If pType = STREAMTYPE.Water Then
- pH = STMTQH(pT, 0#)
- Else
- pH = STMTQH(pT, 1#)
- End If
- ElseIf pP > 0# Then
- If pType = STREAMTYPE.Water Then
- pH = STMPQH(pP, 0#)
- Else
- pH = STMPQH(pP, 1#)
- End If
- End If
- End If
- Else
- pH = Streams(SameAs).H
- End If
- H = pH
- HExit:
- End Property
I have seen a couple of posts from other people on some forums with the same issue but they work around it by changing languages or compilers. I am limited to using VBA in access and am getting extremely frustrated with this problem.
Does anyone know of a solution?
Oh and I am using MS Access 2000 9.0.8961 SP-3