بالله عليكم ساعدوني في حل المشكلة
وجدت مثال للتجويل بين الوحدات ومعرفة الرصيد كرتونة ودرزينة وقطعة
New Microsoft Office Access Application (2)_2.rar
Public Function UnitsDtls(AllUnits As Integer, BoxPockets As Integer, PocketContain As Integer, MyChoice As Byte)
' AllUnits تمثل إجمالي القطع
' BoxPockets عدد الدرزينات في الكرتون الواحد
' PocketContain عدد القطع في كل درزينة أو وحدة فرعية
' MyChoice تحدد أحد الخيارات 1-عدد الكراتين 2-عدد الوحدات الفرعية (الدرزينات) 3-عدد القطع المفردة
'
Dim BoxContain As Integer 'محتوى الكرتون من الوحدات
Dim BoxCnt As Integer 'عدد الكراتين
Dim PocketsCnt As Integer 'عدد الدرزينات
Dim UnitsCnt As Integer 'عدد الوحدات المفردة
BoxContain = (BoxPockets * PocketContain)
BoxCnt = Int(AllUnits / BoxContain)
PocketsCnt = ((((AllUnits / BoxContain) - BoxCnt) * BoxContain) / PocketContain)
'336 144 2 144 12
UnitsCnt = (((AllUnits / BoxContain) - BoxCnt) * BoxContain) Mod PocketContain
Select Case MyChoice
Case Is = 1
UnitsDtls = BoxCnt
Case Is = 2
UnitsDtls = PocketsCnt
Case Is = 3
UnitsDtls = UnitsCnt
Case Else
UnitsDtls = -1
End Select
End Function
ويوجد خطأ في التحويل
واذا غيرت السطر
PocketsCnt = ((((AllUnits / BoxContain) - BoxCnt) * BoxContain) / PocketContain)
الى
PocketsCnt = Int((((AllUnits / BoxContain) - BoxCnt) * BoxContain) / PocketContain)
تظهر مشكلة في الصنف الاخر