pherotao > 05-01-18, 01:31 PM
Private Sub Ghi_Click()
Dim DB As DAO.Database
Dim rs As DAO.Recordset
Set DB = CurrentDb
Set rs = DB.OpenRecordset("SELECT * FROM T_HangHoa")
Select Case strEditAddStatus
Case "Sua"
rs.FindFirst "[MaHH] = '" & Me.txtMaHH.Value & "'"
If Not rs.NoMatch Then
rs.Edit
rs("TenHH") = Me.txtTenHH.Value
rs("QuiCach") = Me.txtQuiCach.Value
rs("DVT") = Me.txtDVT.Value
rs("Ngay") = Me.txtNgay.Value
End If
Case "Them"
rs.AddNew
rs("MaHH") = Me.txtMaHH.Value
rs("TenHH") = Me.txtTenHH.Value
rs("QuiCach") = Me.txtQuiCach.Value
rs("DVT") = Me.txtDVT.Value
rs("Ngay") = Me.txtNgay.Value
End Select
rs.Update