Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
C# Helper...
 
XML RSS Feed
Follow VBHelper on Twitter
 
 
 
MSDN Visual Basic Community
 
 
 
 
 
TitleSee if a table exists in a DAO database by using an On Error statement
DescriptionThis example shows how to see if a table exists in a DAO database by using an On Error statement in Visual Basic 6.
KeywordsDAO, database, table, table exists
CategoriesDatabase
 
Thanks to Simon.

The TableExists function tries to access a TableDef object with the indicated name in the TableDefs collection. If the table does not exist, then an error occurs and Err.Number is not 0.

 
Private Function TableExists(ByVal db As DAO.Database, _
    ByVal table_name As String) As Boolean
Dim td As DAO.TableDef

    On Error Resume Next
    Set td = db.TableDefs(table_name)
    TableExists = (Err.Number = 0)
End Function
 
 
Copyright © 1997-2010 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated