pherotao > 13-12-17, 12:09 AM
Private Sub Ghi_Click()
If IsNull(txtMaHD) Then
MsgOut VniToUni(" Khoâng ñöôïc löu khi khoâng coù Maõ Hoùa Ñôn ! "), vbExclamation
Nhap.SetFocus
Exit Sub
Else
If IsNull(txtNgay) Then
MsgOut VniToUni(" Khoâng ñöôïc löu khi Chöa choïn Ngaøy ! "), vbExclamation
txtNgay.SetFocus
Exit Sub
Else
If IsNull(txtNgay) Then
MsgOut VniToUni(" Khoâng ñöôïc löu khi Chöa choïn Ngaøy ! "), vbExclamation
txtNgay.SetFocus
Exit Sub
Else
If IsNull(txtMaKH) Then
MsgOut VniToUni(" Khoâng ñöôïc löu khi Chöa choïn Khaùch haøng ! "), vbExclamation
txtMaKH.SetFocus
txtMaKH.Dropdown
Exit Sub
Else
If IsNull(txtMaNV) Then
MsgOut VniToUni(" Khoâng ñöôïc löu khi Chöa choïn Nhaân vieân ! "), vbExclamation
txtMaNV.SetFocus
txtMaNV.Dropdown
Exit Sub
Else
If IsNull(List_HH) Then
MsgOut VniToUni(" Phaûi Caäp nhaät Chi tieát Haøng Hoùa ! "), vbExclamation
Them.SetFocus
Exit Sub
Else
Set Db = CurrentDb
Set rs_ghiHD = Db.OpenRecordset("SELECT * FROM T_HoaDon_NX")
rs_ghiHD.AddNew
rs_ghiHD("MaHD") = Me.txtMaHD.Value
rs_ghiHD("SoHD") = Me.txtSoHD.Value
rs_ghiHD("LoaiHD") = Me.txtLoaiHD.Value
rs_ghiHD("Ngay") = Me.txtNgay.Value
rs_ghiHD("MaKH") = Me.txtMaKH.Value
rs_ghiHD("MaNV") = Me.txtMaNV.Value
rs_ghiHD("GhiChu") = Me.txtGhiChu.Value
rs_ghiHD.Update
rs_ghiHD.Close
DoCmd.SetWarnings False
DoCmd.RunSQL ("INSERT INTO T_HangHoa_NX ( MaHD, MaHH, DonGia, SoLuong, ThanhTien ) SELECT T_HangHoa_NX_Temp.MaHD, T_HangHoa_NX_Temp.MaHH, T_HangHoa_NX_Temp.DonGia, T_HangHoa_NX_Temp.SoLuong, T_HangHoa_NX_Temp.ThanhTien FROM T_HangHoa_NX_Temp")
DoCmd.RunSQL ("DELETE T_HangHoa_NX_Temp.* FROM T_HangHoa_NX_Temp")
DoCmd.SetWarnings True
Me.txtMaHD = Null
Me.txtNgay = Date
Me.txtMaKH = Null
Me.txtDiaChi = Null
Me.txtMST = Null
Me.txtDienThoai = Null
Me.txtMaNV = Null
Me.txtGhiChu = Null
List_HH.Requery
End If
End If
End If
End If
End If
End If
End Sub
MTNQ > 13-12-17, 01:48 AM
If List_HH.ListCount = 0 Then
MsgOut VniToUni(" Phaûi Caäp nhaät Chi tieát Haøng Hoùa ! "), vbExclamation
Them.SetFocus
Exit Sub
duynamvnn1208 > 13-12-17, 09:40 AM
Private Sub Ghi_Click()
If IsNull(txtMaHD) Then
MsgOut VniToUni(" Khoang nooic lou khi khoang cou Mao Houa Non ! "), vbExclamation
Nhap.SetFocus
Exit Sub
ElseIf IsNull(txtNgay) Then
MsgOut VniToUni(" Khoang nooic lou khi Choa choin Ngaoy ! "), vbExclamation
txtNgay.SetFocus
Exit Sub
ElseIf IsNull(txtNgay) Then
MsgOut VniToUni(" Khoang nooic lou khi Choa choin Ngaoy ! "), vbExclamation
txtNgay.SetFocus
Exit Sub
ElseIf IsNull(txtMaKH) Then
MsgOut VniToUni(" Khoang nooic lou khi Choa choin Khauch haong ! "), vbExclamation
txtMaKH.SetFocus
txtMaKH.Dropdown
Exit Sub
ElseIf IsNull(txtMaNV) Then
MsgOut VniToUni(" Khoang nooic lou khi Choa choin Nhaan viean ! "), vbExclamation
txtMaNV.SetFocus
txtMaNV.Dropdown
Exit Sub
ElseIf IsNull(List_HH) Then
MsgOut VniToUni(" Phaui Caap nhaat Chi tieat Haong Houa ! "), vbExclamation
Them.SetFocus
Exit Sub
End If
Set Db = CurrentDb
Set rs_ghiHD = Db.OpenRecordset("SELECT * FROM T_HoaDon_NX")
rs_ghiHD.AddNew
rs_ghiHD("MaHD") = Me.txtMaHD
rs_ghiHD("SoHD") = Me.txtSoHD
rs_ghiHD("LoaiHD") = Me.txtLoaiHD
rs_ghiHD("Ngay") = Me.txtNgay
rs_ghiHD("MaKH") = Me.txtMaKH
rs_ghiHD("MaNV") = Me.txtMaNV
rs_ghiHD("GhiChu") = Me.txtGhiChu
rs_ghiHD.Update
rs_ghiHD.Close
DoCmd.SetWarnings False
DoCmd.RunSQL ("INSERT INTO T_HangHoa_NX ( MaHD, MaHH, DonGia, SoLuong, ThanhTien ) SELECT T_HangHoa_NX_Temp.MaHD, T_HangHoa_NX_Temp.MaHH, T_HangHoa_NX_Temp.DonGia, T_HangHoa_NX_Temp.SoLuong, T_HangHoa_NX_Temp.ThanhTien FROM T_HangHoa_NX_Temp")
DoCmd.RunSQL ("DELETE T_HangHoa_NX_Temp.* FROM T_HangHoa_NX_Temp")
DoCmd.SetWarnings True
Me.txtMaHD = Null
Me.txtNgay = Date
Me.txtMaKH = Null
Me.txtDiaChi = Null
Me.txtMST = Null
Me.txtDienThoai = Null
Me.txtMaNV = Null
Me.txtGhiChu = Null
List_HH.Requery
End Sub