Make table query

G

Guest

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.
 
M

[MVP] S.Clark

Create a field(s) in the destination table, then use an update query to
write the value to the table.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Sum problem 1
Extended Price: 3
Report totals off by a couple cents. 4
percentage calculation...trying again 26
percentage calculation 2
...Ambiguous Field Reference..... 2
Total Query 2
Combining 3 queries 2

Top