I refer to the wonderful solution proposed by Hans from the present Forum, about making table with criteria.His code for making the table orders is very efficient and i will repeat it:
StrOrders = “SELECT orderid, customerid, orderdate, [required date]
INTO Temp ” & _
“FROM orders WHERE orderid = ” & Me.orderid
There is a new problem however with making a temporary TempProducts which depends on the table orders.My tables orders,order details and products are related so:
the table orders and the table order details in one to many
the table product with the table order details one to many
the table order details is the connecting table between orders and products .
What i want is to obtain the list of products contained only in the order i have created and , and the number of cartons and the quantity against each product.The fields for the cartons and the quantities are to be found in the table orderdetails, so it is rather complicated.
SELECT orders.orderid, [order details].ProductID, [order details].cartons, [order details].Quantity INTO TempProducts
FROM orders INNER JOIN ([order details] INNER JOIN products ON [order details].ProductID = products.Productid) ON orders.orderid = [order details].OrderID
WHERE (((orders.orderid)=[orderid]));
The above code fails and says that orderid may refer to more than one field.
In SHort, what i aim is to make a table only for these products that are contained in the order i have issued.I cannot do it and i will be grateful for any help