odewallrus
New member
- Local time
- Today, 16:45
- Joined
- Dec 29, 2003
- Messages
- 5
Here is a problem that I am having that seems very simple to me, obviously I am missing something. If some one could help?
I have a house charge field that allows a user to charge all or a portion of a bill. In the AfterUpdate event of the house_charge field is the following code. The problem is that if I enter a house charge amount that is equal to the grand total, in most cases I get the message "A House Charge posted against this work order cannot be greater than the Grand Total, or left blank." I believe that it has to do with the totals being rounded up and thus they are actually less that the house_charge amount. Below I turned on 3 decimal places to show the problem, but in my database I have set currency and 2 decimal places in all forms, tables and queries. Below I am trying to input a value of $340.21 into the house_charge field.
code:
**************************************************
If Me.House_Charge_Amount.Value <= Forms![Customer_information_Form]![Work_Order_Subform]![Work_Order_Customer_Total_Subform]!Grand_Total Then
Me.Other_Payment.SetFocus
Me.House_Charge_Amount.Enabled = False
Me.House_Charge_Amount.Locked = True
Me.Parent.House_Charge_Balance_Subform.Requery
ElseIf MsgBox("A House Charge posted against this work order cannot be greater than the Grand Total, or left blank.", vbOKOnly, "House Charge Help") = vbOK Then
Me.House_Charge_Amount = "0"
Me.House_Charge_Amount_Button.SetFocus
Me.House_Charge_Amount.Enabled = False
Me.House_Charge_Amount.Locked = True
End If
Work_Order_Customer_Total_Subform:
***************************************************
(with 2 decimal places set)
Labor $20.95
Parts $300.00
Sub Total $320.95
Tax $19.26
Grand Total $340.21
(with 3 decimal places set)
Labor $20.95
Parts $300.00
Sub Total $320.95
Tax $19.257
Grand Total $340.207
I have a house charge field that allows a user to charge all or a portion of a bill. In the AfterUpdate event of the house_charge field is the following code. The problem is that if I enter a house charge amount that is equal to the grand total, in most cases I get the message "A House Charge posted against this work order cannot be greater than the Grand Total, or left blank." I believe that it has to do with the totals being rounded up and thus they are actually less that the house_charge amount. Below I turned on 3 decimal places to show the problem, but in my database I have set currency and 2 decimal places in all forms, tables and queries. Below I am trying to input a value of $340.21 into the house_charge field.
code:
**************************************************
If Me.House_Charge_Amount.Value <= Forms![Customer_information_Form]![Work_Order_Subform]![Work_Order_Customer_Total_Subform]!Grand_Total Then
Me.Other_Payment.SetFocus
Me.House_Charge_Amount.Enabled = False
Me.House_Charge_Amount.Locked = True
Me.Parent.House_Charge_Balance_Subform.Requery
ElseIf MsgBox("A House Charge posted against this work order cannot be greater than the Grand Total, or left blank.", vbOKOnly, "House Charge Help") = vbOK Then
Me.House_Charge_Amount = "0"
Me.House_Charge_Amount_Button.SetFocus
Me.House_Charge_Amount.Enabled = False
Me.House_Charge_Amount.Locked = True
End If
Work_Order_Customer_Total_Subform:
***************************************************
(with 2 decimal places set)
Labor $20.95
Parts $300.00
Sub Total $320.95
Tax $19.26
Grand Total $340.21
(with 3 decimal places set)
Labor $20.95
Parts $300.00
Sub Total $320.95
Tax $19.257
Grand Total $340.207