Sửa lỗi
cannguyen > 14-02-12, 12:44 PM
Chào các bạn
Mình đang viết 1 phần mềm in hóa đơn. Đã chạy ok nhưng quá trình chỉnh sửa giờ bị lỗi. Khi mở form hay design nó báo lỗi "There isn't enough memory to perform this operation. Close....."
Bạn nào giúp mình tìm lỗi với.
Code của form đó như sau
Private Sub cuoi_Click()
End Sub
Private Sub Command138_Click()
If NL <> "LY" Then
MsgBox "Nguoi dung nay khong duoc phep Reset lai so hoa don. Vui long lien he nguoi Phu trach ke toan hoac Nha cung cap", vbCritical, "Luu y"
Else
Reset.Visible = True
cHI.Visible = True
End If
End Sub
Private Sub Command72_Click()
Seri.Locked = False
SoCT.Locked = False
NgayCT.Locked = False
MKH.Locked = False
SOTIEN.Locked = False
HOCKY.Locked = False
NAMHOC.Locked = False
HinhThucTT.Locked = False
Huy.Locked = False
End Sub
Private Sub dau_Click()
On Error GoTo Err_dau_Click
DoCmd.GoToRecord , , acFirst
Exit_dau_Click:
Exit Sub
Err_dau_Click:
MsgBox "Day la Hoa don dau tien", vbCritical, "Thong bao"
Resume Exit_dau_Click
End Sub
Private Sub Form_Close()
End Sub
Private Sub Form_Current()
End Sub
Private Sub Form_Error(DataErr As Integer, Response As Integer)
End Sub
Private Sub Form_Load()
Seri.Locked = True
SoCT.Locked = True
NgayCT.Locked = True
MKH.Locked = True
SOTIEN.Locked = True
HOCKY.Locked = True
NAMHOC.Locked = True
HinhThucTT.Locked = True
Huy.Locked = True
DoCmd.GoToRecord , , acLast
End Sub
Private Sub Form_MouseWheel(ByVal Page As Boolean, ByVal Count As Long)
MsgBox "Khong duoc phep lan chuot. Vui long nhan nut ve truoc hoac ve sau", vbCritical, "Luu y"
If Count = -3 Then
DoCmd.GoToRecord , , acNext
Else
DoCmd.GoToRecord , , acPrevious
End If
End Sub
Private Sub Form_Open(Cancel As Integer)
Me.Caption = "LAP HOA DON GIA TRI GIA TANG"
Me.TimerInterval = 600
End Sub
Private Sub Form_Timer()
End Sub
Private Sub Form_Unload(Cancel As Integer)
End Sub
Private Sub NguoiMua_Click()
End Sub
Private Sub NguoiMua_Exit(Cancel As Integer)
End Sub
Private Sub SoPhieu_GotFocus()
End Sub
Private Sub truoc_Click()
On Error GoTo Err_truoc_Click
DoCmd.GoToRecord , , acPrevious
Exit_truoc_Click:
Exit Sub
Err_truoc_Click:
MsgBox "Day la Hoa don dau tien roi!", vbCritical, "Thong bao"
Resume Exit_truoc_Click
End Sub
Private Sub Sau_Click()
On Error GoTo Err_Sau_Click
If SoPhieu = [L] Then
MsgBox "Day la Hoa don cuoi cung roi!", vbCritical, "Thong bao"
Else
DoCmd.GoToRecord , , acNext
Exit_Sau_Click:
Exit Sub
Err_Sau_Click:
MsgBox "Day la Hoa don cuoi cung roi!", vbCritical, "Thong bao"
Resume Exit_Sau_Click
End If
End Sub
Private Sub TimKiem_Click()
On Error GoTo Err_TimKiem_Click
Screen.PreviousControl.SetFocus
DoCmd.DoMenuItem acFormBar, acEditMenu, 10, , acMenuVer70
Exit_TimKiem_Click:
Exit Sub
Err_TimKiem_Click:
MsgBox "Nhan chuot vao chi tieu can tim. Sau do nhan Ctrl+F", vbInformation, "Thong bao"
Resume Exit_TimKiem_Click
End Sub
Private Sub Dong_Click()
On Error GoTo Err_Dong_Click
DoCmd.Close
Exit_Dong_Click:
Exit Sub
Err_Dong_Click:
MsgBox Err.Description
Resume Exit_Dong_Click
End Sub
Private Sub In_Click()
On Error GoTo Err_In_Click
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.PrintOut acSelection
Exit_In_Click:
Exit Sub
Err_In_Click:
MsgBox Err.Description
Resume Exit_In_Click
End Sub
Private Sub Cuoicung_Click()
On Error GoTo Err_Cuoicung_Click
DoCmd.GoToRecord , , acLast
Exit_Cuoicung_Click:
Exit Sub
Err_Cuoicung_Click:
MsgBox "Day la Hoa don cuoi cung roi!", vbCritical, "Thong bao"
Resume Exit_Cuoicung_Click
End Sub
Private Sub Them_Click()
If IsNull(TT) Then
MsgBox "Hoa don nay da tao moi nhung chua LUU, Vui long kiem tra lai!", vbCritical, "Luu y"
Else
If MaKH <> "" Then
DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70
DoCmd.GoToRecord , , acNewRec
SoPhieu.Locked = False
Seri.Locked = False
SoCT.Locked = False
NgayCT.Locked = False
MKH.Locked = False
TenKH.Locked = False
NguoiMua.Locked = False
DiaChi.Locked = False
MST.Locked = False
HinhThucTT.Locked = False
MatHang.Locked = False
Huy.Locked = False
NVBanHang.Locked = False
TT.Locked = False
TTDV.Locked = False
Seri.SetFocus
N = "T"
Else
MsgBox "Ban chua chon Ma Khach hang. Vui long chon truoc khi Them moi", vbCritical, "Luu y"
End If
End If
End Sub
Private Sub Xoa_Click()
On Error GoTo Err_Xoa_Click
If SoPhieu = 1 Then
MsgBox "Hoa don nay khong duoc xoa!. So lieu se khong anh huong gi!", vbCritical, "Luu y"
Else
If NL <> "CAN" Then
MsgBox "Nguoi dung nay khong duoc phep xoa", vbCritical, "Luu y"
Else
Dim TraLoi
If IsNull(SoPhieu) Or IsNull(SoCT) Then
MsgBox "Khong the xoa Du lieu trong", 48, "Luu y'"
Else
TraLoi = MsgBox("Ban co thuc su muon xoa Hoa don so: " & Chr(10) & Chr(13) & [SoCT] & " không?", 48 + 4, "Thong bao")
If TraLoi = 6 Then
DoCmd.SetWarnings False
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
DoCmd.GoToRecord , , acFirst
DoCmd.SetWarnings True
End If
End If
End If
End If
Exit_Xoa_Click:
Exit Sub
Err_Xoa_Click:
MsgBox "Du lieu van ton tai!", vbCritical, "Thong bao"
Resume Exit_Xoa_Click
End Sub
Private Sub lUU_Click()
On Error GoTo Err_lUU_Click
If IsNull(SoPhieu) Or IsNull(Seri) Or IsNull(SoCT) Or IsNull(MKH) Or IsNull(TenKH) Or IsNull(HinhThucTT) Then
MsgBox "Chua nhap du Du lieu. Kiem tra lai", vbCritical, "Thong bao"
Else
DonVi = "cuulong"
TT = "Hop le"
DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
Seri.Locked = True
SoCT.Locked = True
NgayCT.Locked = True
MKH.Locked = True
SOTIEN.Locked = True
HOCKY.Locked = True
NAMHOC.Locked = True
HinhThucTT.Locked = True
Huy.Locked = True
DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70
MsgBox "Thanh cong!", vbInformation, "Thong bao"
If IsNull(NguoiDung) Then
NguoiDung = "CAN"
DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70
End If
End If
Exit_lUU_Click:
Exit Sub
Err_lUU_Click:
MsgBox "Kiem tra du lieu", vbCritical, "thong bao"
Resume Exit_lUU_Click
End Sub
Private Sub Command130_Click()
On Error GoTo Err_Command130_Click
DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70
Exit_Command130_Click:
Exit Sub
Err_Command130_Click:
MsgBox Err.Description
Resume Exit_Command130_Click
End Sub
Private Sub Thoat_Click()
On Error GoTo Err_Thoat_Click
If SoPhieu = 1 Then
MsgBox "Hoa don nay khong duoc xoa!. So lieu se khong anh huong gi!", vbCritical, "Luu y"
Else
Dim TraLoi
If [TT] = "Hop le" Or IsNull(N) Then
DoCmd.Close
Else
TraLoi = MsgBox("Ban tao moi ma chua Luu hoa don so: " & Chr(10) & Chr(13) & [SoCT] & ", Hoa don nay chua hop le. Ban co muon huy bo phieu nay?", 48 + 4, "Thong bao")
If TraLoi = 6 Then
DoCmd.SetWarnings False
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
DoCmd.GoToRecord , , acFirst
DoCmd.SetWarnings True
DoCmd.Close
End If
End If
End If
Exit_Thoat_Click:
Exit Sub
Err_Thoat_Click:
MsgBox "Du lieu van ton tai!", vbCritical, "Thong bao"
Resume Exit_Thoat_Click
End Sub
Private Sub LIETKE_Click()
On Error GoTo Err_LIETKE_Click
DoCmd.OpenQuery "TaoBang_SubTimKiem"
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "LietKe"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_LIETKE_Click:
Exit Sub
Err_LIETKE_Click:
MsgBox Err.Description
Resume Exit_LIETKE_Click
End Sub
Private Sub Command182_Click()
On Error GoTo Err_Command182_Click
DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70
Exit_Command182_Click:
Exit Sub
Err_Command182_Click:
MsgBox Err.Description
Resume Exit_Command182_Click
End Sub
Private Sub Command183_Click()
On Error GoTo Err_Command183_Click
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
Exit_Command183_Click:
Exit Sub
Err_Command183_Click:
MsgBox Err.Description
Resume Exit_Command183_Click
End Sub
Private Sub Command196_Click()
On Error GoTo Err_Command196_Click
DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70
Exit_Command196_Click:
Exit Sub
Err_Command196_Click:
MsgBox Err.Description
Resume Exit_Command196_Click
End Sub
Private Sub Command199_Click()
On Error GoTo Err_Command199_Click
MKH.SetFocus
Seri.Locked = False
SoCT.Locked = False
NgayCT.Locked = False
MKH.Locked = False
SOTIEN.Locked = False
HOCKY.Locked = False
NAMHOC.Locked = False
HinhThucTT.Locked = False
Huy.Locked = False
DoCmd.GoToRecord , , acNewRec
Exit_Command199_Click:
Exit Sub
Err_Command199_Click:
MsgBox Err.Description
Resume Exit_Command199_Click
End Sub
(Có kèm file nhé)
Mong các bác giúp mình gấp
Xin cảm ơn