vannguyen0206 > 13-11-12, 02:52 PM
nhannt4 > 14-11-12, 12:23 PM
Private Sub Command0_Click()
Dim DB As Database
Dim Rs As Recordset
Dim stt As Integer
Dim dongia As Double
Dim tien As Double
Dim sluong As Integer
Set DB = CurrentDb()
Set Rs = DB.OpenRecordset("DMTHUOC_TOA", DB_OPEN_TABLE)
If (Rs.BOF) Then
MsgBox "KHONG CO DU LIEU"
Rs.Close
Exit Sub
End If
tien = 0
Rs.MoveFirst
Do While Not Rs.EOF
stt = Rs!stt
If (stt = 15) Then
dongia = Rs!dongia
sluong = Rs!SoLuong
tien = tien + (dongia * sluong)
Rs.MoveNext
Else
Rs.MoveNext
End If
Loop
Rs.Close
MsgBox "Tong tien: " & tien
End Sub