I have a very simple piece of code which deletes the import error tables for 6 file imports.
Private Sub DeleteImportErrorTables_Click()
'Delete the import error tables for those created due to header row.
DoCmd.DeleteObject acTable, "Call0CurrentFile_ImportErrors"
DoCmd.DeleteObject acTable, "Call1CurrentFile_ImportErrors"
DoCmd.DeleteObject acTable, "Call2CurrentFile_ImportErrors"
DoCmd.DeleteObject acTable, "Call3CurrentFile_ImportErrors"
DoCmd.DeleteObject acTable, "Call6CurrentFile_ImportErrors"
DoCmd.DeleteObject acTable, "Call7CurrentFile_ImportErrors"
End Sub
The problem is that if an import error table is not produced for any of the imports, an error message is displayed saying that the file could not be found.
Could somebody please help me with a simple error handling code to add to this? I did try adding the code in red below but that didn’t work.
Private Sub DeleteImportErrorTables_Click()
On Error GoTo Err_DeleteImportErrorTables _Click
'Delete the import error tables for those created due to header row.
DoCmd.DeleteObject acTable, "Call0CurrentFile_ImportErrors"
DoCmd.DeleteObject acTable, "Call1CurrentFile_ImportErrors"
DoCmd.DeleteObject acTable, "Call2CurrentFile_ImportErrors"
DoCmd.DeleteObject acTable, "Call3CurrentFile_ImportErrors"
DoCmd.DeleteObject acTable, "Call6CurrentFile_ImportErrors"
DoCmd.DeleteObject acTable, "Call7CurrentFile_ImportErrors"
Exit_ DeleteImportErrorTables _Click:
Exit Sub
Err_ DeleteImportErrorTables _Click:
MsgBox Err.Description
Resume Exit_ DeleteImportErrorTables _Click
End Sub
Thank you.
Private Sub DeleteImportErrorTables_Click()
'Delete the import error tables for those created due to header row.
DoCmd.DeleteObject acTable, "Call0CurrentFile_ImportErrors"
DoCmd.DeleteObject acTable, "Call1CurrentFile_ImportErrors"
DoCmd.DeleteObject acTable, "Call2CurrentFile_ImportErrors"
DoCmd.DeleteObject acTable, "Call3CurrentFile_ImportErrors"
DoCmd.DeleteObject acTable, "Call6CurrentFile_ImportErrors"
DoCmd.DeleteObject acTable, "Call7CurrentFile_ImportErrors"
End Sub
The problem is that if an import error table is not produced for any of the imports, an error message is displayed saying that the file could not be found.
Could somebody please help me with a simple error handling code to add to this? I did try adding the code in red below but that didn’t work.
Private Sub DeleteImportErrorTables_Click()
On Error GoTo Err_DeleteImportErrorTables _Click
'Delete the import error tables for those created due to header row.
DoCmd.DeleteObject acTable, "Call0CurrentFile_ImportErrors"
DoCmd.DeleteObject acTable, "Call1CurrentFile_ImportErrors"
DoCmd.DeleteObject acTable, "Call2CurrentFile_ImportErrors"
DoCmd.DeleteObject acTable, "Call3CurrentFile_ImportErrors"
DoCmd.DeleteObject acTable, "Call6CurrentFile_ImportErrors"
DoCmd.DeleteObject acTable, "Call7CurrentFile_ImportErrors"
Exit_ DeleteImportErrorTables _Click:
Exit Sub
Err_ DeleteImportErrorTables _Click:
MsgBox Err.Description
Resume Exit_ DeleteImportErrorTables _Click
End Sub
Thank you.