Query on Purchases

rbs

Board Regular
Joined
Oct 6, 2002
Messages
58
Hi Everyone,

I have a query for which i list the total quantity on hand of inventory.

I then have created a query which lists all of the purchase orders relating to this inventory.

I want to limit this query to only list the most recent purchase orders so that the quanities add up to the total quanity on hand.

This will then give me the purchase orders that the stock arrived on, not all purchase orders that have ever come in.

Can anyone help?

Thanks,

Natalie.
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
I think I understand what you're doing.
You want to identify, probably on a first-in, first-out basis which purchase order your inventory came from.

I'm thinking this is not something you're going to be able to do via simple SQL, *unless* your inventory tracks each individual item, not totals by item. If you track each individual item, you could include a field that identifies the source PO and group your results on that field.

If not; if you simply track quantity – that you have 10 units of Item X, then you have a lot more work and you have to make some assumptions.

My approach here would be:

1) Find out how many of a given item you have
2) Look at each PO where that item was ordered, work backwards chronologically until you have enough raw quantity included (possibly multiple PO’s) until you are equal are greater than the current inventory
3) Artificially ‘assign’ your current inventory count working backwards chronologically
4) Write your results to a temporary/report table
5) Repeat for each item


Mike
 
Upvote 0

Forum statistics

Threads
1,221,645
Messages
6,161,044
Members
451,682
Latest member
ogoreo

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top