Object presence in DB

Hi,

I'm wondering if anyone has a quick way to find out if an objects exists in a '97 DB? I have seen something before that tries to instansiate a table object and then traps the error, but I was looking for something a little bit more universal.

Re: Object presence in DB

The routine you saw probably looked something like this:

<pre>Function TableExists(strTableName As String) As Boolean
' This procedure returns True or False depending
' on whether the table named in strTableName exists.
Dim dbs As DAO.Database
Dim tdf As DAO.TableDef

To do something more global in Access 97, you could query the MSysObjects table for the object type you were checking (you have to use the numeric types, though, and watch out for attached tables). Or you could use the name of the container for the object, (i.e., "tables", "forms", "reports", "modules", "Macros", "queries" and modify the above code to something like this: