aşağıya yuvarlama

Katılım
22 Nisan 2005
Mesajlar
245
aşağıdaki kod ilköğretim okullarında ağırlıklı ortalamayı hesaplıyor. ama hata yapıyor 3,566 yi 3,57 yuyarlıyor. ilemi aşağı yuvarlayıp 3,566 yı 3,56 ya 2,395 i 2,39 yuvarlaması gerekiyor kodu düzeltebilirmisiniz.

ption Compare Database

Private Sub ActiveXDen38_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Long, ByVal Y As Long)

End Sub

Private Sub Etiket40_Click()
DoCmd.GoToRecord , , acLast
a = Form_agirlik.CurrentRecord
kay = a
DoCmd.GoToRecord , , acFirst

For i = 1 To a
ActiveXDen38 = i * 100 / a
' 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
'4 6 4 0 3 3 0 0 2 2 1 1 2 3 0 0 3 0
'5 6 4 0 3 3 0 0 2 2 1 1 2 3 0 0 3 0
'6 5 4 0 3 3 0 0 4 2 1 1 2 2 1 0 2 0
'7 5 4 0 3 3 1 0 4 2 1 1 2 2 0 0 2 0
'8 5 4 0 3 0 1 2 4 2 1 1 2 2 1 0 2 0
If snf = 4 Then
ag = Int(100 * (q1 * 6 + q2 * 4 + q4 * 3 + q5 * 3 + q8 * 2 + q9 * 2 + q10 + q11 + q12 * 2 + q13 * 3 + q16 * 3) / 30) / 100
s4 = Left$(ag, 5)
End If

If snf = 5 Then
ag = Int(100 * (q1 * 6 + q2 * 4 + q4 * 3 + q5 * 3 + q8 * 2 + q9 * 2 + q10 + q11 + q12 * 2 + q13 * 3 + q16 * 3) / 30) / 100
s5 = Left$(ag, 5)
End If

If snf = 6 Then
ag = Int(100 * (q1 * 5 + q2 * 4 + q4 * 3 + q5 * 3 + q8 * 4 + q9 * 2 + q10 + q11 + q12 * 2 + q13 * 2 + q14 + q16 * 2) / 30) / 100
s5 = Left$(ag, 5)
End If

If snf = 7 Then
ag = Int(100 * (q1 * 5 + q2 * 4 + q4 * 3 + q5 * 3 + q8 * 4 + q9 * 2 + q10 + q11 + q12 * 2 + q13 * 2 + q6 + q16 * 2) / 30) / 100
s7 = Left$(ag, 5)
End If

If snf = 8 Then
ag = Int(100 * (q1 * 5 + q2 * 4 + q4 * 3 + q6 + q7 * 2 + q8 * 4 + q9 * 2 + q10 + q11 + q12 * 2 + q13 * 2 + q14 + q16 * 2) / 30) / 100
s8 = Left$(ag, 5)
End If
If i = a Then
GoTo son
End If
DoCmd.GoToRecord , , acNext
Next i
son:
MsgBox "Ağırlıklı yılsonu notları işlendi"
Form_menu.Alt0.SourceObject = "menu4"
Form_menu4.ys1 = -1

End Sub
 
Katılım
14 Mart 2005
Mesajlar
87
SAYIN RECEP;
SİZİN YAZDIÐINIZ KADAR KODLARDAN ANLAMIYORUM AMA SİZİN İSTEDİÐİNİZ YUVARLAMA DEÐİL SAYIYI KIRPMAK SANKİ....

SOLDAN 4 KAREKTERİNİ AL ÞEKLİNDE KÜÇÜK BİR FORMÜLASYONLA HALLEDEBİLİRSİNİZ SANIYORUM....?
 
Katılım
28 Temmuz 2004
Mesajlar
275
ag = Int(100 * (q1 * 6 + q2 * 4 + q4 * 3 + q5 * 3 + q8 * 2 + q9 * 2 + q10 + q11 + q12 * 2 + q13 * 3 + q16 * 3) / 30) / 100


satırlarında önce tamsayı alınıp daha sonra 100'e bölünmesinin nedeni bu zaten. Böylece sayı kırpılıyor.

Ama Access gözüyle değil de Excel gözüyle bakarak buna neden olabilecek bir hata göremedim. Sanki formuller doğru gibi.
 
Üst