I have a multi line item order that I need to read into a form with a query where
a couple of line items fields need to be contained on one line for each quantity ordered.
Quantities ordered will vary from sales order to sales order and it is assumed that each
order will contain a line item for the same software for each line item of computer ordered.
I have the following tables:
PC_tbl contains a computer part number, a computer description, and a computer Type:
PartNO . PartDesc . PartType
10001 . Computer IBM . Desktop
10002 . Computer IBM . Laptop
20001 . Computer Dell . Desktop
20002 . Computer Dell . Laptop
30001 . Computer HP . Desktop
30002 . Computer HP . Laptop
Soft_tbl which contains a part number and a description
PartNO . PartDesc
10222 . Bogus Software
10333 . MS Office 2012
10444 . Corel Draw
10555 . Adobe Illustrator
I pull the sales order from an ERP system into a table named
Order_tbl which depending on the order, might resemble something like this:
LineNO . OrderNO . PartNO . PartDesc . Qty
1 . 100100 . 10001 . Computer IBM 2
2 . 100100 . 20002 . Computer Dell 1
3 . 100100 . 10222 . Bogus Software 3
and on a continuous form, I wish to display the following:
Order# . Item . System . Computer . Type . Software
100100 . 1 . Computer IBM . Desktop . Bogus Software
100100 . 2 . Computer IBM . Desktop . Bogus Software
100100 . 3 . Computer Dell . Laptop . Bogus Software
I am having a hard time figuring out the query and so far came up
with the following:
SELECT Order_tbl.OrderNO, Null AS Item, PC_tbl.PartDesc AS System, PC_tbl.PartType AS ComputerType, Soft_tbl.PartDesc AS Software
FROM (Order_tbl LEFT JOIN Soft_tbl ON Order_tbl.PartNo = Soft_tbl.PartNo) LEFT JOIN PC_tbl ON Order_tbl.PartNo = PC_tbl.PartNo;
Also, I wasn't sure how to set the Item (set to Null) in the query.
D0 I need to do this with more than one Query in order to set up each line in a table with one query and then create a query to
use that table's data to populate the form?
What am I missing?
Thanks
a couple of line items fields need to be contained on one line for each quantity ordered.
Quantities ordered will vary from sales order to sales order and it is assumed that each
order will contain a line item for the same software for each line item of computer ordered.
I have the following tables:
PC_tbl contains a computer part number, a computer description, and a computer Type:
PartNO . PartDesc . PartType
10001 . Computer IBM . Desktop
10002 . Computer IBM . Laptop
20001 . Computer Dell . Desktop
20002 . Computer Dell . Laptop
30001 . Computer HP . Desktop
30002 . Computer HP . Laptop
Soft_tbl which contains a part number and a description
PartNO . PartDesc
10222 . Bogus Software
10333 . MS Office 2012
10444 . Corel Draw
10555 . Adobe Illustrator
I pull the sales order from an ERP system into a table named
Order_tbl which depending on the order, might resemble something like this:
LineNO . OrderNO . PartNO . PartDesc . Qty
1 . 100100 . 10001 . Computer IBM 2
2 . 100100 . 20002 . Computer Dell 1
3 . 100100 . 10222 . Bogus Software 3
and on a continuous form, I wish to display the following:
Order# . Item . System . Computer . Type . Software
100100 . 1 . Computer IBM . Desktop . Bogus Software
100100 . 2 . Computer IBM . Desktop . Bogus Software
100100 . 3 . Computer Dell . Laptop . Bogus Software
I am having a hard time figuring out the query and so far came up
with the following:
SELECT Order_tbl.OrderNO, Null AS Item, PC_tbl.PartDesc AS System, PC_tbl.PartType AS ComputerType, Soft_tbl.PartDesc AS Software
FROM (Order_tbl LEFT JOIN Soft_tbl ON Order_tbl.PartNo = Soft_tbl.PartNo) LEFT JOIN PC_tbl ON Order_tbl.PartNo = PC_tbl.PartNo;
Also, I wasn't sure how to set the Item (set to Null) in the query.
D0 I need to do this with more than one Query in order to set up each line in a table with one query and then create a query to
use that table's data to populate the form?
What am I missing?
Thanks