Hi everyone,
I'm working on a database that needs to value FIFO
inventory based on actual costs per unit. The source data
is in a query that combines item receiving/return history,
and sorts the results by item ID and by receipt date.

So, what I get from this query looks like this:

ITEM # RECPT_DATE QTY UNIT_COST
A1 10/15/2001 100 5.50
A1 09/02/2001 50 6.00
A1 06/10/2001 40 7.00
A2 12/02/2001 75 15.00
A2 07/20/2001 20 14.50

Now, I have another table that tells me the total on hand
quantities of each item in inventory.

ITEM # TOT_QTY
A1 [WEIGHTED average cost]
A2 [WEIGHTED average cost]

Since I only want to get the WEIGHTED average cost of
these items, I need the total quantity by item table to
limit the calculation on the first table to a subset of
the most recent recipts that reach the total on hand
quantity of that item.

So, is this possible to do with VBA?

Any ideas? ANY help would be much appreciated!!

Thx.