Access/VBA Library

TableExists

Returns a Boolean indicating if the requested table exists.

Syntax

TableExists( table )
Parameters
Name Type Description
table String Required. The name of the table to be checked.
Return value

Boolean : True when table exists, otherwise False.

Code
Function TableExists(table As String) As Boolean

    Dim td As TableDef
    
On Error GoTo TableExists_error
    Set td = CurrentDb.TableDefs(table)
    ' Call successfull: table exists
    TableExists = True
TableExists_exit:
    Exit Function
    
TableExists_error:
    ' Error occured, table does not exist
    TableExists = False
    Resume TableExists_exit
End Function

Databasetag:DatabaseTabletag:TableValidationtag:Validation