muaphonui_2010 > 20-12-11, 04:13 PM
muaphonui_2010 > 20-12-11, 05:45 PM
Private Sub moi_Click()
sp.Locked = False
ngaythang.Locked = False
makhach.Locked = False
noidung.Locked = False
sotien.Locked = False
tenkhach.Locked = False
diachi.Locked = False
thucuathang.Locked = False
nam.Locked = False
nguoinoptien.Locked = False
DoCmd.GoToRecord , , acLast
If makhach <> "" And thucuathang <> "" And sotien <> "0" Then
makhach.SetFocus
On Error GoTo Err_moi_Click
DoCmd.GoToRecord , , acLast
txtsp.Value = Val(Mid([sp], 7, 5))
DoCmd.GoToRecord , , acNewRec
sp.Value = "PT/" & Month(Date) & "/" & txtsp + 1
Exit_moi_Click:
Else
MsgBox "Chu' y':Ban chua cap nhat day du du lieu," & vbCrLf & "yeu cau ban phai cap nhat day du du~ lieu truoc' khi tao bang moi'"
Exit Sub
Err_moi_Click:
MsgBox "Chu' y' So' Phieu' nay` da ton` tai ( da trung`)." & vbCrLf & " Bay gio` ban hay sua~ so' phieu' [" & sp & "] nay` thanh` so' phieu' khac' " & vbCrLf & " va sau do' luu lai,roi` moi' tiep' tuc lam` tiep' duoc! "
Resume Exit_moi_Click
End If
End Sub
Private Sub luu_Click()
On Error GoTo Err_luu_Click
If makhach <> "" And thucuathang <> "" And sotien <> "0" Then
sp.Locked = True
ngaythang.Locked = True
makhach.Locked = True
noidung.Locked = True
sotien.Locked = True
tenkhach.Locked = True
diachi.Locked = True
thucuathang.Locked = True
nam.Locked = True
nguoinoptien.Locked = True
Else
ngaythang.SetFocus
MsgBox "Chu' y': ban chua cap nhat day du du lieu", vbOKOnly + vbExclamation, "THONG BAO"
End If
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
Exit_luu_Click:
Exit Sub
Err_luu_Click:
MsgBox " Chu' y': so' phieu' [" & sp & "]nay` da ton` tai, xin vui long` kiem~ tra lai", vbOKOnly + vbExclamation, "THONG BAO"
Resume Exit_luu_Click
End Sub
Private Sub sua_Click()
sp.Locked = False
ngaythang.Locked = False
makhach.Locked = False
noidung.Locked = False
sotien.Locked = False
tenkhach.Locked = False
diachi.Locked = False
thucuathang.Locked = False
nam.Locked = False
nguoinoptien.Locked = False
End Sub
Private Sub makhach_Click()
tenkhach.Value = DLookup("tenkhach", "Q_dotenkhachphieuthu")
diachi.Value = DLookup("diachi", "Q_dotenkhachphieuthu")
End Sub
Private Sub dongia_GotFocus()
'If mahang <> "" Then ' nếu mã hàng khác rổng thì mới thực hiện
'If (DLookup("nhomkhach", "Q_dokhachhangsuachua")) = "Khach le" Then
'dongia.Value = DLookup("giabanle", "Q_domahangsuachua")
'Else
'dongia.Value = DLookup("giabansi", "Q_domahangsuachua")
'End If
Else
End If
End Sub
Private Sub dongia_GotFocus()
'If mahang <> "" and [b]Forms!F_banhang!supform.Locked = false [/b]Then ' nếu mã hàng khác rổng và chưa khóa thì mới thực hiện
'If (DLookup("nhomkhach", "Q_dokhachhangsuachua")) = "Khach le" Then
'dongia.Value = DLookup("giabanle", "Q_domahangsuachua")
'Else
'dongia.Value = DLookup("giabansi", "Q_domahangsuachua")
'End If
Else
End If
End Sub
nhokkungfubmt > 24-03-13, 04:06 PM
muaphonui_2010 > 07-04-13, 06:08 PM
(24-03-13, 04:06 PM)nhokkungfubmt Đã viết: Mình vẫn ko hiểu lắm bạn có file code nút Lưu, Thêm, Xóa ko cho mình với
Xuân Thanh > 07-04-13, 06:33 PM