luunhatky > 12-06-13, 04:57 PM
wintq > 13-06-13, 08:48 AM
Xuân Thanh > 13-06-13, 10:58 AM
haidc > 13-06-13, 04:31 PM
luunhatky > 14-06-13, 06:08 PM
Xuân Thanh > 15-06-13, 04:15 PM
Private Sub txtSoLuong_AfterUpdate()
Dim rs As Recordset
Set rs = CurrentDb.openRecordset("tblHangHoa", dbOpenTable)
rs.Index = "PrimaryKey"
rs.Seek "=", Me.MaHang
If Not rs.NoMatch Then
rs.Edit
rs!Ton = rs!Ton + Me.txtSoLuong
rs.Update
End If
End Sub
Private Sub txtSoLuong_AfterUpdate()
Dim rs As Recordset
Set rs = CurrentDb.openRecordset("tblHangHoa", dbOpenTable)
rs.Index = "PrimaryKey"
rs.Seek "=", Me.MaHang
If Not rs.NoMatch Then
If rs!Ton < Me.txtSoLuong Then
MsgBox "Khong the xuat vuot so ton" , , "Chu y"
Exit Sub
Me.txtSoLuong.SetFocus
Else
rs.Edit
rs!Ton = rs!Ton - Me.txtSoLuong
rs.Update
End If
End If
End Sub