A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Inventory Loop



 
 
Thread Tools Display Modes
  #1  
Old June 1st, 2010, 10:59 PM posted to microsoft.public.access.queries
Jim
external usenet poster
 
Posts: 39
Default Inventory Loop

I need a way to loop through an invoice and figure out the number of boxes
being used per order. We have the same product that can go into multiple
size boxes depending on the quantity shipped. For example:



Widget A with a shipped quantity of 1 would go into box A which is 4X4X12

Widget A with a shipped quantity of 2-4 would go into box B which is 6X6X10

Widget A with a shipped quantity of 5 would go into both box A & B (1 each)



Thanks



Jim


  #2  
Old June 2nd, 2010, 12:11 AM posted to microsoft.public.access.queries
Jeff Boyce
external usenet poster
 
Posts: 8,621
Default Inventory Loop

Jim

I'm going to assume that you'd want to use the most appropriate box first
.... in your example, the third quantity (5) would, because it is greater
than the capacity of BoxB, would have the capacity of BoxB (4) subtracted,
then the most appropriate box for the remaining count (1), which would be
BoxA.

Or if you don't want to do the looping (Access is a relational database ...
you don't really need to loop), what if you used the MOD function to find
out how many BoxB's you can use, and use the remainder to see if you need a
BoxA?

Do you have a table that lists how many of which items can fit in which
boxes? If not, start there. You can use that to look up the box capacity
for your MOD() function.

Good luck!

Regards

Jeff Boyce
Microsoft Access MVP

--
Disclaimer: This author may have received products and services mentioned
in this post. Mention and/or description of a product or service herein
does not constitute endorsement thereof.

Any code or pseudocode included in this post is offered "as is", with no
guarantee as to suitability.

You can thank the FTC of the USA for making this disclaimer
possible/necessary.

"Jim" wrote in message
...
I need a way to loop through an invoice and figure out the number of boxes
being used per order. We have the same product that can go into multiple
size boxes depending on the quantity shipped. For example:



Widget A with a shipped quantity of 1 would go into box A which is 4X4X12

Widget A with a shipped quantity of 2-4 would go into box B which is
6X6X10

Widget A with a shipped quantity of 5 would go into both box A & B (1
each)



Thanks



Jim




  #3  
Old June 2nd, 2010, 12:17 AM posted to microsoft.public.access.queries
KARL DEWEY
external usenet poster
 
Posts: 10,767
Default Inventory Loop

You need to create a table tblBoxSelect with three fields --
Product QTY Box_Size
Left join Invoice to tblBoxSelect on Product and Size.

Need_Box: IIF(tblBoxSelect.Box_Size Is Null, "Unknown",
tblBoxSelect.Box_Size)

Or

Need_Box: IIF(Invoice.Product = tblBoxSelect.Product AND Invoice.QTY =
tblBoxSelect.QTY, tblBoxSelect.Box_Size, "Unknown")


--
Build a little, test a little.


"Jim" wrote:

I need a way to loop through an invoice and figure out the number of boxes
being used per order. We have the same product that can go into multiple
size boxes depending on the quantity shipped. For example:



Widget A with a shipped quantity of 1 would go into box A which is 4X4X12

Widget A with a shipped quantity of 2-4 would go into box B which is 6X6X10

Widget A with a shipped quantity of 5 would go into both box A & B (1 each)



Thanks



Jim


.

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 12:02 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.