G
Guest
This one baffles me.
The two text boxes get their values from me setting the Control Source
property for each to '=Sum(Collection)'. Collection is a field in the query
this is based on.
When i run the code I get an Overflow error. Err#6.
When I set a breakpoint on the first line of code then step through it, it
works just fine. The variables get set to the proper values, the math works
and the txtPerHour box displays the result. In run mode sngTotalHours is
Empty, curTotalCollection = 0 so then I get the overflow error trying to
divide by zero!
Anyone know what is going on here?
Private Sub Form_Current()
Dim sngTotalHours, sngAverage As Single
Dim curTotalCollection As Currency
lblProp.Caption = strNB
sngTotalHours = txtTotalHours.Value
curTotalCollection = txtTotalCollection.Value
sngAverage = curTotalCollection / sngTotalHours
txtPerHour.Value = Format(sngAverage, "$##.00")
End Sub
Thanks, Bart
The two text boxes get their values from me setting the Control Source
property for each to '=Sum(Collection)'. Collection is a field in the query
this is based on.
When i run the code I get an Overflow error. Err#6.
When I set a breakpoint on the first line of code then step through it, it
works just fine. The variables get set to the proper values, the math works
and the txtPerHour box displays the result. In run mode sngTotalHours is
Empty, curTotalCollection = 0 so then I get the overflow error trying to
divide by zero!
Anyone know what is going on here?
Private Sub Form_Current()
Dim sngTotalHours, sngAverage As Single
Dim curTotalCollection As Currency
lblProp.Caption = strNB
sngTotalHours = txtTotalHours.Value
curTotalCollection = txtTotalCollection.Value
sngAverage = curTotalCollection / sngTotalHours
txtPerHour.Value = Format(sngAverage, "$##.00")
End Sub
Thanks, Bart