T
Terri
I have a form procedure in which I'm doing very simple math and would like a
calculation to produce a decimal to two places, but I'm not sure how to do
this in VBA. My code:
Dim intTmMin1 As Integer
Dim intTmMin2 As Integer
Dim intTmHr As Integer
Dim intRateTot As Double
Dim strMsg As String
On Error GoTo Err_AddNew_Click
'Update rate/hr
intRateTot = Nz([Abst_FullCase], 0) + Nz([Abst_AHI], 0)
intTmMin1 = Nz([AbstTmMin], 0)
intTmMin1 = (intTmHr * 60) + intTmMin1
intRateTot = (intRateTot \ intTmMin1)
Me!RatePerHr = intRateTot
It basically adds contents of some fields together to get a total, then
calculates total minutes, using an hour and minute numeric field. I'm
expecting the line
intRateTot = (intRateTot\intTmMin1|
to produce a decimal, but it rounds off, i.e. 135/105 produces 1 rather than
1.28.
I'm sure this is something very simple, but I can't seem to figure it out
:-0.
Thanks - Terri
calculation to produce a decimal to two places, but I'm not sure how to do
this in VBA. My code:
Dim intTmMin1 As Integer
Dim intTmMin2 As Integer
Dim intTmHr As Integer
Dim intRateTot As Double
Dim strMsg As String
On Error GoTo Err_AddNew_Click
'Update rate/hr
intRateTot = Nz([Abst_FullCase], 0) + Nz([Abst_AHI], 0)
intTmMin1 = Nz([AbstTmMin], 0)
intTmMin1 = (intTmHr * 60) + intTmMin1
intRateTot = (intRateTot \ intTmMin1)
Me!RatePerHr = intRateTot
It basically adds contents of some fields together to get a total, then
calculates total minutes, using an hour and minute numeric field. I'm
expecting the line
intRateTot = (intRateTot\intTmMin1|
to produce a decimal, but it rounds off, i.e. 135/105 produces 1 rather than
1.28.
I'm sure this is something very simple, but I can't seem to figure it out
:-0.
Thanks - Terri