I have an invoice form with an invoice subform displaying the items and amounts (similar to the Northwind Orders form). I need to have the invoice total be saved in the underlying invoice table once a button is clicked (which when clicked, does other things also). I kinda got it, but just having some trouble.
What I did is in the subform's footer I entered a unbound field that calculates the total of the amounts using the sum() function. Then in the onClick of my control I entered the code:
Me.invoice_Total = [InvoiceSubform].Form![SumAmount] (sumAmount being the unbound control I was talking about befor and invoice_Total is bound to the Invoice_Total field in the Invoice Table)
I have two problems with this. First, that line is one of the first lines in the OnClick procedure, and for whatever reason that line completes before that actual calculation of the invoice total completes, so it is always being set to 0 (or the previous value if any amounts are being edited).
My second problem is that the Invoice_Total field is leaving out the decimal. So if the invoice total calculated in the subform is $45.67, the Invoice_Total field will only display 45. In the Invoice Table I have the data type set to currency.
What am i missing here???
What I did is in the subform's footer I entered a unbound field that calculates the total of the amounts using the sum() function. Then in the onClick of my control I entered the code:
Me.invoice_Total = [InvoiceSubform].Form![SumAmount] (sumAmount being the unbound control I was talking about befor and invoice_Total is bound to the Invoice_Total field in the Invoice Table)
I have two problems with this. First, that line is one of the first lines in the OnClick procedure, and for whatever reason that line completes before that actual calculation of the invoice total completes, so it is always being set to 0 (or the previous value if any amounts are being edited).
My second problem is that the Invoice_Total field is leaving out the decimal. So if the invoice total calculated in the subform is $45.67, the Invoice_Total field will only display 45. In the Invoice Table I have the data type set to currency.
What am i missing here???