Applefritter
Registered User.
- Local time
- Today, 09:11
- Joined
- Jul 22, 2004
- Messages
- 14
Howdy,
I'm missing something because my calculations are off on a form. I have a form with a textbox labeled "txtStartupTemperature". The value I insert here will affect another value in a textbox labeled "txtStartupTCF". If my temperature value is <= 25, I will use one formula for my calculation. If my temperature value is >25 then I will use an alternate formula. Both formulas involve exponentials. Here's the code I developed for my public function:
Public Function TCF(ByVal sngValue As Single) As Single
Select Case sngValue
Case Is <= 25
TCF = Exp(3480 * (1 / 298 - 1 / (273 + txtStartupTemperature)))
Case Is > 25
TCF = Exp(2640 * (1 / 298 - 1 / (273 + txtStartupTemperature)))
Case Else
End Select
End Function
In my form's code I've inserted the following:
Private Sub txtStartupTemperature_AfterUpdate()
Me.txtStartupTCF = TCF(Me.txtStartupTemperature)
End Sub
I tested this code with a temperature value of 15. This should calculate out to be 0.67. Instead I'm getting 0.34. Are my formulas written correctly? If so, what else could be going on?
I'm missing something because my calculations are off on a form. I have a form with a textbox labeled "txtStartupTemperature". The value I insert here will affect another value in a textbox labeled "txtStartupTCF". If my temperature value is <= 25, I will use one formula for my calculation. If my temperature value is >25 then I will use an alternate formula. Both formulas involve exponentials. Here's the code I developed for my public function:
Public Function TCF(ByVal sngValue As Single) As Single
Select Case sngValue
Case Is <= 25
TCF = Exp(3480 * (1 / 298 - 1 / (273 + txtStartupTemperature)))
Case Is > 25
TCF = Exp(2640 * (1 / 298 - 1 / (273 + txtStartupTemperature)))
Case Else
End Select
End Function
In my form's code I've inserted the following:
Private Sub txtStartupTemperature_AfterUpdate()
Me.txtStartupTCF = TCF(Me.txtStartupTemperature)
End Sub
I tested this code with a temperature value of 15. This should calculate out to be 0.67. Instead I'm getting 0.34. Are my formulas written correctly? If so, what else could be going on?