First, let me start by saying I know what an overflow is (Too large of a value into something that can't hold it, i.e. 35000 into an int, or 0/0, etc).
Now to the issue. I have a class that I am trying to apply a value to one of its properties.
where STMPTH() is a Steam Table look up method that takes a Double P and Double T and returns a Double H (Pressure, Temperature, return Enthalpy)
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:
So, I decide to use Step Through (F8) to try to debug the issue (thinking maybe I'm passing a negative value or something). But when I hit F8, the program continues without a hitch.
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:
However, this little "work around" does not want to work in this case and I am now at a loss as to how to fix this.
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
Now to the issue. I have a class that I am trying to apply a value to one of its properties.
Code:
...
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:
Code:
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:
Code:
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
Comment