Them Sua Xoa
Private Sub CmdThem_Click()
If CmdThem.Caption = "Thªm" Then
CmdThem.Caption = "Huû"
CmdSua.Enabled = False
CmdXoa.Enabled = False
CmdThoat.Enabled = False
Cmddau.Enabled = False
Cmdtruoc.Enabled = False
CmdTiep.Enabled = False
Cmdcuoi.Enabled = False
Adohang.Recordset.AddNew
TxtMahang.SetFocus
Else
CmdThem.Caption = "Thªm"
CmdSua.Enabled = True
CmdXoa.Enabled = True
CmdThoat.Enabled = True
Cmddau.Enabled = True
Cmdtruoc.Enabled = True
CmdTiep.Enabled = True
Cmdcuoi.Enabled = True
Adohang.Recordset.CancelUpdate
End If
End Sub
*********************************************
Private Sub CmdSua_Click()
If CmdSua.Caption = "Söa" Then
CmdSua.Caption = "Huû"
TxtMahang.SetFocus
CmdThem.Enabled = False
CmdXoa.Enabled = False
CmdThoat.Enabled = False
Cmddau.Enabled = False
Cmdtruoc.Enabled = False
CmdTiep.Enabled = False
Cmdcuoi.Enabled = False
CmdLuu.Enabled = True
Else
CmdSua.Caption = "Söa"
CmdThem.Enabled = True
CmdXoa.Enabled = True
CmdThoat.Enabled = True
Cmddau.Enabled = True
Cmdtruoc.Enabled = True
CmdTiep.Enabled = True
Cmdcuoi.Enabled = True
CmdLuu.Enabled = False
End If
End Sub
*************************************
Private Sub CmdXoa_Click()
If MsgBox("Ban co chac chan xoa?", vbYesNo + vbQuestion, "Th«ng b¸o") = vbYes Then
Adohang.Recordset.Delete adAffectCurrent
Adohang.Refresh
End If
End Sub
Bạn đang đọc truyện trên: Truyen247.Pro