condition on DeleteObject action in macro

  • Thread starter Thread starter lynn
  • Start date Start date
L

lynn

Hi,

I need to delete a table and then re-import it ... How do
I run the deleteobject action only if the table exists?
 
Lynn,

You can't check for the existence of an object with a macro. The best
way around this, as far as I know, is to create a Make-Table Query to
make a table with the name of the table you want to delete, and use an
OpenQuery action to run this Make-Table before the DeleteObject action.
If the table didn't exist, it will now. If it did exist, the
Make-Table will overwrite it, which doesn't matter because you are
trashing it anyway. Either way, the DeleteObject will proceed without
an error.
 
Back
Top