C
Clare
Similar to the northwind database I have a form to enter a sales order which
takes data from the sales order and customer tables:
SELECT tblSaOr.SalesOrderID, tblSaOr.CustomerID, tblSaOr.CustomerRef,
tblSaOr.OrderDate, tblSaOr.DespatchDate, tblSaOr.ShipVia,
tblSaOr.ShippingCost, tblC.Title, tblC.FirstName, tblC.Surname,
tblSaOr.EstDespatchDate, "PI" & [tblSaOr]![SalesOrderID] AS InvoiceNumber,
tblSaOr.TotalCost
FROM tblC INNER JOIN tblSaOr ON tblC.CustomerID = tblSaOr.CustomerID;
The subform extended order details takes data from the sales order details
table and the product table.
SELECT tblSODetails.SalesOrderID, tblSODetails.ProductID, tblPro.Product,
tblPro.UnitPrice, tblSODetails.Quantity, tblSODetails.Discount,
CCur([tblPro].[UnitPrice]*[tblSODetails].[Quantity]*(1-[tblSODetails].[Discount])/100)*100 AS ExtendedPrice, tblPro.Unit
FROM tblPro INNER JOIN tblSODetails ON tblPro.ProductID =
tblSODetails.ProductID;
The subform calculates the sum of Extended price, a calculated field on the
main form adds the shipping to that subtotal to come up with the total order
value. A command button on the form prints the invoice. I would like to run
a make table query once the print button has been pressed to save the
following details in a separate sales ledger table which can then be used as
the basis for the financial side of the database.
The fields I would like to store are:
"PI" & [tblSaOr]![SalesOrderID] AS InvoiceNumber
tblSaOr.SalesOrderID, tblSaOr.CustomerID, tblSaOr.CustomerRef,
tblSaOr.OrderDate, tblSaOr.DespatchDate,tblSaOr.ShippingCost, and the total
order value which is the sum of extended price and the shipping -
CCur([tblPro].[UnitPrice]*[tblSODetails].[Quantity]*(1-[tblSODetails].[Discount])/100)*100 AS ExtendedPrice.
Because the subtotal and grandtotal are calculated fields I don't know how I
can actually store these in a table.
Any help would be greatly appreciated if this is actually possible.
takes data from the sales order and customer tables:
SELECT tblSaOr.SalesOrderID, tblSaOr.CustomerID, tblSaOr.CustomerRef,
tblSaOr.OrderDate, tblSaOr.DespatchDate, tblSaOr.ShipVia,
tblSaOr.ShippingCost, tblC.Title, tblC.FirstName, tblC.Surname,
tblSaOr.EstDespatchDate, "PI" & [tblSaOr]![SalesOrderID] AS InvoiceNumber,
tblSaOr.TotalCost
FROM tblC INNER JOIN tblSaOr ON tblC.CustomerID = tblSaOr.CustomerID;
The subform extended order details takes data from the sales order details
table and the product table.
SELECT tblSODetails.SalesOrderID, tblSODetails.ProductID, tblPro.Product,
tblPro.UnitPrice, tblSODetails.Quantity, tblSODetails.Discount,
CCur([tblPro].[UnitPrice]*[tblSODetails].[Quantity]*(1-[tblSODetails].[Discount])/100)*100 AS ExtendedPrice, tblPro.Unit
FROM tblPro INNER JOIN tblSODetails ON tblPro.ProductID =
tblSODetails.ProductID;
The subform calculates the sum of Extended price, a calculated field on the
main form adds the shipping to that subtotal to come up with the total order
value. A command button on the form prints the invoice. I would like to run
a make table query once the print button has been pressed to save the
following details in a separate sales ledger table which can then be used as
the basis for the financial side of the database.
The fields I would like to store are:
"PI" & [tblSaOr]![SalesOrderID] AS InvoiceNumber
tblSaOr.SalesOrderID, tblSaOr.CustomerID, tblSaOr.CustomerRef,
tblSaOr.OrderDate, tblSaOr.DespatchDate,tblSaOr.ShippingCost, and the total
order value which is the sum of extended price and the shipping -
CCur([tblPro].[UnitPrice]*[tblSODetails].[Quantity]*(1-[tblSODetails].[Discount])/100)*100 AS ExtendedPrice.
Because the subtotal and grandtotal are calculated fields I don't know how I
can actually store these in a table.
Any help would be greatly appreciated if this is actually possible.