for GSayi=1 to 60 döngüsünü 1 den fazla kontrolsüz kullandığınız için oluyor bir kontrol edin isterseniz.
1 for döngüsünde işlemde sorun yok fakat ikinci for döngüsüne girdiği vakit üst alan değerlerini tekrar hesaba katarak devam edyor. bu her seferinde tekrarlandıı için yeni ürün de seçtiğiniz için hep artarak gidiyor.
Private Sub Form_Current()
For GSayi = 1 To 60
Controls("mtn_tutar" & GSayi) = 0
Controls("fiy" & GSayi) = Controls("acl_malz" & GSayi).Column(2)
mtn_maliyet = Nz(mtn_maliyet, 0) + Nz(Controls("mtn_tutar" & GSayi), 0)
Next
mtn_indirim = 0
mtn_net = 0
mtn_kar = 0
mtn_net = N0
mtn_maliyetek = 0
mtn_netek = 0
mtn_nettek = 0
mtn_toptek = 0
For GSayi = 1 To 60
Controls("mtn_tutar" & GSayi) = Controls("mtn_mik" & GSayi) * Controls("fiy" & GSayi)
Controls("fiy" & GSayi) = Controls("acl_malz" & GSayi).Column(2)
mtn_maliyet = Nz(mtn_maliyet, 0) + Nz(Controls("mtn_tutar" & GSayi), 0)
Next
mtn_indirim = mtn_maliyet * mtn_oran / 100
mtn_net = Nz([mtn_maliyet]) + (Nz([mtn_kar]) - Nz([mtn_indirim]))
mtn_kar = mtn_maliyet * mtn_karoran / 100
mtn_net = Nz([mtn_maliyet]) + (Nz([mtn_kar]) - Nz([mtn_indirim]))
mtn_maliyetek = Nz([mtn_tutar55]) + Nz([mtn_tutar56]) + Nz([mtn_tutar57]) + Nz([mtn_tutar58]) + Nz([mtn_tutar59]) + Nz([mtn_tutar60])
mtn_netek = Nz([mtn_maliyetek]) + Nz([mtn_karek])
mtn_nettek = Nz([mtn_netek])
mtn_toptek = Nz([mtn_net]) + Nz([mtn_netek])
If acl_cap > 3500 Then
etkal = 16
ElseIf acl_cap > 2800 Then
etkal = 14
ElseIf acl_cap > 2500 Then
etkal = 12
Else
etkal = 10
End If
bombehacmi = ((0.13 * (Nz([acl_cap]) - 20) * (Nz([acl_cap]) - 20) * (Nz([acl_cap]) - 20)) / 1000000000) * 2
ghacmi = Nz([acl_hacim]) - Nz([bombehacmi])
gboyu = (Nz([ghacmi]) * 4) / ((3.14159265 * (Nz([acl_cap]) - 20) * (Nz([acl_cap]) - 20)) / 1000000000) - 200
tuzun = Nz([gboyu]) + 200 + (0.26 * acl_cap - 20) * 2
cevre = 3.14159265 * Nz([acl_cap]) - (etkal * 3.14159265)
govdea = (cevre * (gboyu + 200) * etkal * 7860) / 1000000000
bombea = (2 * (2 * 3.14159265 * (1.174 * Nz([acl_cap]) + 1.7 * 100) * (1.174 * Nz([acl_cap]) + 1.7 * 100) * Nz([etkal]) / 1000000))
tplagirlik = govdea + bombea
mtn_mik4 = (govdea / 1000)
mtn_mik5 = (govdea / 1000)
If acl_cap = 0 Then 'tüm değerlerin silinmesi için kontrol.
bombehacmi = 0
ghacmi = 0
gboyu = 0
tuzun = 0
cevre = 0
govdea = 0
bombea = 0
tplagirlik = 0
etkal = 0
End If
Stop
DoCmd.Maximize
End Sub