Adding data to Subform and save and running a total price calc

S

Simon

I have a database for placing customer order, i have a frmOrder and
then two subforms, one which shows items in order and then subform
with a list of products we sell, on the subform of products we sell i
have a button that adds that product, price ect to the subform of
procucts the customer has orderd.
As i add the product i want frmOrder.Total to update but can not
getting this to work
I think i have a problem when when the item is added its not saving or
somthing


DoCmd.Save

'go to new record

Forms![frmOrder]![OrderProductsForm].SetFocus
DoCmd.RunCommand acCmdSelectRecord
DoCmd.GoToRecord , , acNewRec


Forms![frmOrder]![OrderProductsForm].Form![OrderNumber] = Forms!
[frmOrder]![OrderNumber]
Forms![frmOrder]![OrderProductsForm].Form![IDNumber] =
CLng(Nz(DMax("IDNumber", "tblOrderProduct"), 0)) + 1
Forms![frmOrder]![OrderProductsForm].Form![ProductName] =
Me.ProductName
Forms![frmOrder]![OrderProductsForm].Form![ProductCode] =
Me.ProductCode
Forms![frmOrder]![OrderProductsForm].Form![ProductID] = Me.ProductID
Forms![frmOrder]![OrderProductsForm].Form![Discount] = 0
Forms![frmOrder]![OrderProductsForm].Form![UnitPriceExVAT] =
Me.txtPrice
Forms![frmOrder]![OrderProductsForm].Form![UnitPriceIncVAT] =
FormatNumber(Forms![frmOrder]![OrderProductsForm].Form!
[UnitPriceExVAT] * stVAT, 2)
Forms![frmOrder]![OrderProductsForm].Form![TotalIncVAT] =
FormatNumber(Forms![frmOrder]![OrderProductsForm].Form!
[UnitPriceExVAT] * stVAT, 2)
Forms![frmOrder]![OrderProductsForm].Form![TotalExVAT] = Me.txtPrice
Forms![frmOrder]![OrderProductsForm].Form![Quantity] = 1
DoCmd.Save
Me.Requery
DoCmd.Save



Forms![frmOrder]!Total = DSum("[TotalIncVAT]", "tblOrderProduct",
"[OrderNumber] = Forms![frmOrder]!OrderNumber.Value")
Forms![frmOrder]!SubTotal = DSum("[TotalExVAT]", "tblOrderProduct",
"[OrderNumber] = Forms![frmOrder]!OrderNumber.Value")
Forms![frmOrder]!VAT = Forms.frmOrder.Total - Forms.frmOrder.SubTotal
Forms![frmOrder]![Outstanding] = Forms![frmOrder]![Total] -
(DLookup("Amount", "qryPaymentsTotals", "OrderNumber = " & Forms!
[frmOrder]!OrderNumber.Value))



Any on e got ideas on how to make saves to Forms![frmOrder]!
[OrderProductsForm].
 
Top