Sub soru2()
Dim db As Database
Dim rst As Recordset
Set db = CurrentDb
Set rst = db.OpenRecordset("Tablo1")
topy = 0
topm = 0
topk = 0
Do Until rst.EOF
topy = topy + rst.Fields("yaş").Value
topk = topk + 1
topm = topm + rst.Fields("maaş").Value
rst.MoveNext
Loop
orty = topy / topk
ortm = topm / topk
MsgBox "Ortalama yaş: " & orty & Chr(13) & "Ortalama maaş: " & ortm
End Sub
Yorumlar
Yorum Gönder