Hi Scott,
I think you may have to venture into the world of VBA ... instead of trying
to accomplish this with macros.
It's an evoutionary thing ... as your skills progress, so will your
expectations ... so you will likely end up having to learn some VBA. :)
You could use this function (courtesy Chuck Grimsby) which is quite simple:
================================================== =
Function DropTheTable(strTableName As String, _
Optional bolShowErrors As Boolean = False) _
As Boolean
Dim myDB As DAO.Database
Set myDB = CurrentDb
On Error Resume Next
myDB.Execute "DROP TABLE [" & strTableName & "]", dbFailOnError
If Err.Number <0 Then
If bolShowErrors = True Then MsgBox (Err.Description)
DropTheTable = False
Else
DropTheTable = True
myDB.Tabledefs.Refresh 'This was added by me.
End If
Set myDB = Nothing
End Function
I actually have some code that automates the whole process, from
start-to-finish, for a fixed-width text-import (if that is what you are
doing)
Let me know if you're interested in seeing it.
"Scott" <sc**********@ns.sympatico.cawrote in message
news:do********************@ursa-nb00s0.nbnet.nb.ca...
>I have a macro set up to delete a table and then it imports an up-to-date
copy of the table. Every once in a while the table gets deleted but the
new one isn't imported, I assume the user is closing the database before
the macro finishes running. The next time the macro runs it comes up with
an error becuase the delete table part of the macro can't find the table.
Is there any way to have the macro check to see if the table is there and
if not skip the delete piece?