I need some advice on the best way to solve this issue – whether it makes sense to address it with a query or better to write a vba function.
I have a table with orders and requested delivery dates. Assume that all orders are for the same item number. An order can have multiple delivery quantities and dates. The table would look like:
[pre]Order_ID Delivery_ID Quantity Expected_Date
101 1 1000 1/1/2017
101 2 2000 3/1/2017
101 3 2000 4/1/2017
201 1 6000 3/15/2017
[/pre]
There is another table that shows actual deliveries to date by Order_ID. The quantity delivered is applied to the outstanding orders on FIFO (first in, first out) basis:
[pre]Order_ID Quantity_Delivered
101 1200
[/pre]
I want the result to show the Orders with outstanding quantities by Expected_Date. So with the above data, the result would be:
[pre]Order_ID Delivery_ID Quantity Expected_Date
101 2 800 3/1/2017
101 3 2000 4/1/2017
201 1 6000 3/15/2017
[/pre]
Can this be handled with a standard query? Or is it best to create some temp tables and use vba to loop through the data to determine which items are completely shipped?
Thanks.
I have a table with orders and requested delivery dates. Assume that all orders are for the same item number. An order can have multiple delivery quantities and dates. The table would look like:
[pre]Order_ID Delivery_ID Quantity Expected_Date
101 1 1000 1/1/2017
101 2 2000 3/1/2017
101 3 2000 4/1/2017
201 1 6000 3/15/2017
[/pre]
There is another table that shows actual deliveries to date by Order_ID. The quantity delivered is applied to the outstanding orders on FIFO (first in, first out) basis:
[pre]Order_ID Quantity_Delivered
101 1200
[/pre]
I want the result to show the Orders with outstanding quantities by Expected_Date. So with the above data, the result would be:
[pre]Order_ID Delivery_ID Quantity Expected_Date
101 2 800 3/1/2017
101 3 2000 4/1/2017
201 1 6000 3/15/2017
[/pre]
Can this be handled with a standard query? Or is it best to create some temp tables and use vba to loop through the data to determine which items are completely shipped?
Thanks.