As a part of my application, I need to delete a table from an Access database. I have no problem doing that with the following code:
DoCmd.RunSQL "DROP TABLE myTable;"
However, depending on how far into the application the user is, that table may or may not exist. If it doesn't, the above statement throws the error "Table 'myTable' does not exist".
I have tried using SQL statements such as IF EXISTS to try to build a query that will first check for the existence of the table, and then delete it or not. But the IF EXISTS statement causes errors in the RunSQL method.
Does anybody have any suggestions on how to first check if a table exists, and then delete it (or not).
DoCmd.RunSQL "DROP TABLE myTable;"
However, depending on how far into the application the user is, that table may or may not exist. If it doesn't, the above statement throws the error "Table 'myTable' does not exist".
I have tried using SQL statements such as IF EXISTS to try to build a query that will first check for the existence of the table, and then delete it or not. But the IF EXISTS statement causes errors in the RunSQL method.
Does anybody have any suggestions on how to first check if a table exists, and then delete it (or not).