What is the difference between a "Box" and a "Pill_Box"?
Will the pill bottles packed in that box always be the same or could bottles with different contents be packed in the same box?
Are the bottles always the same size/shape?
In this instance Pill _box is no different than a line items table creating line items to fill an order/Box.
There can be between 1 and 5 pill bottles in each box. The bottles can be filled with different pill types, with different data stored in the pill bottle attributes.
Then you definitely do not need multiple relationships to set a limit on the number of pill bottles packed in your box.
To repeat a question not yet answered: Are all pill bottles the same size and shape?
To add a new question: Are all boxes the same size and shape?
If you have all boxes the same and all Pill Bottles the same (in terms of physical dimensions, not contents), this is an easy problem. If they are not, this can become very complex to manage due to the very large number of variables involved.
Bottles and boxes are all the same size and shape.
Then you simply need to limit the number of related Pill_Bottle records (or the total of their quantity fields) to the maximum allowed for the box.
Key design decision needed here: One Pill_Bottle record for every bottle in the box or do you want to add a Qty field so that if you add 3 bottles of "aspirin", you can create one record for it with 3 in the quantity field?
With one record for every bottle and a fairly small number of bottles to every box, you might not need to do more than set up a portal to Pill_Bottle on your box layout sized to have exactly the same number of rows as the max number of bottles and no scroll bar to allow the user to go over the limit.
Otherwise, you can set up a calculation field, cBottlecount, in Box as either Sum ( Pill_Bottle::Qty ) or Count ( Pill_Bottle::Box_ID ) to check to see if the limit for a given box has been reached.
A validation rule on a field or fields in Pill_Bottle with this calculation:
Box::cBottlecount < 10
could be used to limit the pill_bottle records created for a given box to no more than 10 bottles. Trying to enter data to create a 11th bottle record sould throw up a validation error message.