From: Jim on
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


From: Jeff Boyce on
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" <jim(a)gordonferon.com> wrote in message
news:%23LUXoWdALHA.1764(a)TK2MSFTNGP04.phx.gbl...
>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
>
>


From: KARL DEWEY on
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
>
>
> .
>