I'm having trouble with this code to delete a table in Microsoft Access.
When I run code the first time table is deleted. When I run code the second time table is NOT deleted. When I run code the third time table is deleted.
Here's my code:
strTableName = "TableA"
CheckTable = IsObject(CurrentDb.TableDefs(strTableName))
'CheckTable = TRUE at this point
If CheckTable = True Then
checkTableSQL = "DROP TABLE " + strTableName
DBEngine(0)(0).Execute checkTableSQL, dbFailOnError
End If
CheckTable = IsObject(CurrentDb.TableDefs(strTableName))
'Still CheckTable = TRUE at this point