Not so sure about the grammar but the arith. here is good.
Re grammer, I understand Dozen to proper syntax for singular and plural, so dozens would not be correct (except in the generic sense of an undefined quantity of more than 1 dozen and in quantities which are even multiples of 12). Also, it is not common to list 0 quantities, as in 2 Dozen and 0 pieces, or the reverse -0 dozen and 3 pieces, so some additional work should be applied to the return string.
Finally, if the requirement is to list quantity groups, the process should (?) go to the additional level(s) of dozens (12 dozen = 144 =
some name i can't rember at the moment perhaps "Gross"?
Then, perhaps the whole issue should be considered differently. If there is a need to categorize quantities, Should the quantity type be included in the calling args, and then break the qty arg down by the type? So qtyType "Liquid Measure", should return Gallons, Quarts, Pints and ounces? and so on and so forth?
Code:
Public Function basNum2Dzn(QtyIn As Long) As String
'Michael Red 9/7/2002 Tek-Tips thread705-353436
Dim Pcs As Integer
Dim Dzns As Long
Pcs = QtyIn Mod 12
Dzns = (QtyIn - Pcs) / 12
basNum2Dzn = Dzns & " Dozen and " & Pcs & " Pieces"
End Function
MichaelRed
m.red@att.net
There is never time to do it right but there is always time to do it over