Ervin Brindza
viner at eunet.yu
Tue Sep 23 02:59:42 CDT 2003
Crossposted Acess-L& AccessD Hi, I'm in the very beginning of a tiny little app, and need some advice. The main goal of this little application is to print a report for each customer, like: Customer Name OrderNo1 OrderNo2 ...etc. ItemNo ItemName Amount1 Amount2 E.g. Ervin Brindza O1 O2.... 1. Fish 1.5 1.3 2. Meat 2.3 2.4 3. Flour 4.5 3.5 ... I made an "Order -> OrderDetails"(1 to many) form and subform(Order:CustomerName, OrderNo;OrderDetails: ItemNo, ItemName, Amount) , and when the new order is requested I generate the items in the subform(from the Products table), and the user input the amount values. Then each order have to be listed on the report as one column, like above. I tried with crosstab query, and the query is ok, but when I try to use it in report wizard there is no fields, and I don't know how to make a report? Here is the SQL: qryOrderAndDetail: SELECT DISTINCTROW Order.OrderId, Order.OrderNo, Order.CustomerName, OrderDetails.ItemNo, OrderDetails.ItemName, OrderDetails.Amount FROM [Order] INNER JOIN OrderDetails ON Order.OrderId = OrderDetails.OrderId; qryCross: PARAMETERS Forms!frm1!Customer Text; TRANSFORM Sum(qryOrderAndDetail.Amount) AS [The Value] SELECT qryOrderAndDetail.ItemName, Sum(qryOrderAndDetail.Amount) AS [Total Of Amount] FROM qryOrderAndDetail WHERE (((qryOrderAndDetail.CustomerName)=[Forms]![frm1]![Customer])) GROUP BY qryOrderAndDetail.ItemName, qryOrderAndDetail.CustomerName PIVOT qryOrderAndDetail.OrderNo; Many thanks in advance, Ervin -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://databaseadvisors.com/pipermail/accessd/attachments/20030923/a01f7c5d/attachment.html>