deleting a table if it exists

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Any help appreciated...

in my macro, which imports a text file each time it runs, I occasionally get an import errrors table generated, but not all the time... is there some way to put an action in the macro to delete a table, if it exists, that has the phase "import errors" in it...right now, I have to manually delete the import errors table every so often

thanks

Craig
 
I don't know how to do it in a macro but here is some
simple converrted macro code that you can put in your
On_Click event that
will delete the table. If the table does not exist it just
continiues on.

Private Sub Command12_Click()
On Error Resume Next
'*********
' Put your import commands here
'*********
DoCmd.DeleteObject acTable, "tablename1"
DoCmd.DeleteObject acTable, "tablename2"

Beep
MsgBox " tablename1 & tablename2 have been deleted"
'*********
' Or put your import commands here
'*********
delete_object_Exit:
Exit Sub

delete_object_Err:
MsgBox Error$
Resume delete_object_Exit

End Sub

Jim

-----Original Message-----
Any help appreciated...

in my macro, which imports a text file each time it runs,
I occasionally get an import errrors table generated, but
not all the time... is there some way to put an action in
the macro to delete a table, if it exists, that has the
phase "import errors" in it...right now, I have to manually
delete the import errors table every so often
 
Back
Top