It is pretty long. Sorry.
The error occurs after the file is output, and the table is open, all
records selected, and I try to deleteallrecords.
In some cases, there are no records to delete, so I want to
automatically ignore the error and resume. I can get it to resume, but
I don't know how to ignore the error.
Thanks.
Function Output_Term_Open_Items()
On Error GoTo Output_Term_Open_Items_Err
DoCmd.Minimize
' Deloitte Banner
DoCmd.OpenForm "Deloitte Banner", acNormal, "", "", , acNormal
DoCmd.Echo True, ""
DoCmd.SetWarnings False
' TermLoanOpenItemsClear
DoCmd.OpenQuery "TermLoanOpenItemsClear", acViewNormal, acEdit
' C:\Documents and Settings\TermLoansClear.xls
DoCmd.OutputTo acTable, "TermLoanOpenItems",
"MicrosoftExcelBiff8(*.xls)", "C:\Documents and
Settings\TermLoansClear.xls", True, "", 0
' TermLoanOpenItems
DoCmd.OpenTable "TermLoanOpenItems", acViewNormal, acEdit
' SelectAllRecords
DoCmd.RunCommand acCmdSelectAllRecords
' DeleteRecord
' Delete Output Pricing
DoCmd.RunCommand acCmdDeleteRecord
' TermLoanOpenItems
DoCmd.Close acTable, "TermLoanOpenItems"
' TermLoanOpenItemsOpen
DoCmd.OpenQuery "TermLoanOpenItemsOpen", acViewNormal, acEdit
' C:\Documents and Settings\TermLoansOpen.xls
DoCmd.OutputTo acTable, "TermLoanOpenItems",
"MicrosoftExcelBiff8(*.xls)", "C:\Documents and
Settings\TermLoansOpen.xls", True, "", 0
' TermLoanOpenItems
DoCmd.OpenTable "TermLoanOpenItems", acViewNormal, acEdit
' SelectAllRecords
DoCmd.RunCommand acCmdSelectAllRecords
' DeleteRecord
' Delete Output Pricing
DoCmd.RunCommand acCmdDeleteRecord
' TermLoanOpenItems
DoCmd.Close acTable, "TermLoanOpenItems"
' TermLoanOpenItemsYS
DoCmd.OpenQuery "TermLoanOpenItemsYS", acViewNormal, acEdit
' C:\Documents and Settings\TermLoansYS.xls
DoCmd.OutputTo acTable, "TermLoanOpenItems",
"MicrosoftExcelBiff8(*.xls)", "C:\Documents and
Settings\TermLoansYS.xls", True, "", 0
' TermsOpenItemsLB
DoCmd.Close acForm, "TermsOpenItemsLB"
' TermLoanOpenItems
DoCmd.OpenTable "TermLoanOpenItems", acViewNormal, acEdit
' SelectAllRecords
DoCmd.RunCommand acCmdSelectAllRecords
' DeleteRecord
' Delete Output Pricing
DoCmd.RunCommand acCmdDeleteRecord
' TermLoanOpenItems
DoCmd.Close acTable, "TermLoanOpenItems"
' Back to Tabstrip
DoCmd.RunMacro "Back to Tabstrip", , ""
Output_Term_Open_Items_Exit:
Exit Function
Output_Term_Open_Items_Err:
MsgBox Error$
Resume Output_Term_Open_Items_Exit
End Function