SteveL13
asked on
Why getting an overflow error when tryint to open a form
I'm getting an overflow error when a form opens. The code gets stuck on:
Me.txtDollarsPerHour = IIf(Me.txtActualHours = 0, 0, Me.txtDollarsPerHour = Me.txtFee / Me.txtActualHours)
Note: If I put a breakpoint on the line then Me.DollarsPerHour is null. Maybe that has something to do with it?
Me.txtDollarsPerHour = IIf(Me.txtActualHours = 0, 0, Me.txtDollarsPerHour = Me.txtFee / Me.txtActualHours)
Note: If I put a breakpoint on the line then Me.DollarsPerHour is null. Maybe that has something to do with it?
ASKER
Yes. It is zero. How do I fix the code?
See above, I updated my comment...
»bp
»bp
ASKER
Still getting overflow. Both txtActualHours and txtFee are zero.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
txtFee is currency. txtActualHours is Number, single, standard, 2. txtDollarsPerHour is currency.
ASKER
This worked:
If txtActualHours = "0" Then
txtDollarsPerHour = "0"
Else
txtDollarsPerHour = txtFee / txtActualHours
End If
Thanks!
If txtActualHours = "0" Then
txtDollarsPerHour = "0"
Else
txtDollarsPerHour = txtFee / txtActualHours
End If
Thanks!
Welcome, glad that helped.
»bp
»bp
Me.txtDollarsPerHour = IIf(Me.txtActualHours = 0, 0, Me.txtFee / Me.txtActualHours)
»bp