VBA: Check if table exists

=========
QUESTION
———
In Microsoft Access 2007, using VBA, how can you check to see if a table exists?

=========
EXAMPLES
———
On Error Resume Next

———

Public Function dbsTableDelete(DBName)
    Count = 0
    tblNotFound = False
    Do Until tblNotFound
        If DBName = dbs2020.TableDefs(Count).Name Then
            dbs2020.TableDefs.Delete (DBName)
            Exit function
        End If
        Count = Count + 1
        ‘Determine if we are at the very end of the table listing or not,
        ‘if we are then the table wasn’t found,
        ‘end the Do loop and exit the function
        If dbs2020.TableDefs.Count = Count Then
            tblNotFound = True
        End If
    Loop
End Function

———

=========
REF
———
http://www.tek-tips.com/viewthread.cfm?qid=933401 

http://forums.devarticles.com/microsoft-access-development-49/access-2000-delete-a-table-if-it-exists-using-code-3821.html

=========
APPLIES TO / KEYWORDS
———
Microsoft Access
VBA


http://www.anysitesupport.com/vba-check-if-table-exists/


By | 2017-12-01T23:47:51+00:00 April 7th, 2011|Access, Computers, Documentation, Microsoft, VBA|0 Comments