The easiest way is to open the database window and click on the tables tab.
If you had other requirements, you should probably provide them. We don't
know if you want to check with sql or code or?
The easiest way is to open the database window and click on the tables tab.
If you had other requirements, you should probably provide them. We don't
know if you want to check with sql or code or?
dim db as database, td as tabledef
set db = currentdb()
on error resume next
set td = db.tabledefs("MyTable")
if err.number <> 0 then set td = nothing
on error goto 0
if td is nothing then
' table did not exist.
else
' table exists, and its properties are in td.
...
set td = nothing
endif
set db = nothing
To check in some other database, use:
set db = dbengine.opendatabase ("path to other database")
Method 1: SQL
See if this returns anything:
SELECT Name FROM MSysObjects
WHERE ((Name = "MyTable") AND (Type = 1));
Use IN between the FROM and WHERE clauses for an external database.
Method 2: DAO
See if you get an error referring to the TableDef, or loop through all
TableDefs of the CurrentDb(). Use OpenDatabase if it's a different file.
Method 3: ADOX
See if you get an error referring to the Table and check the Type, or loop
through all Tables of the Catalog. Open a Connection for an external file.
I am sorry if I offended anyone. I just expect a little more information
from posters. At times it seems that posters with questions are not willing
to take the time to ask a complete question. Those of us that spend a fair
amount of time attempting to assist have to make assumptions and guess
regarding requirements, table structures, data values, etc.
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.