Home > DeveloperSection > Forums > What is the way for finding out whether a table exists in the Microsoft Access database?
Ashish Pandey

Total Post:128

Points:898
Posted on    November-17-2012 4:32 AM

 MS Access MS Access 
Ratings:


 2 Reply(s)
 1739  View(s)
Rate this:
Hi Guys
Can someone tell me
what is the way for finding out whether a table exists in the Microsoft Access database?

Thanks



AVADHESH PATEL

Total Post:604

Points:4228
Posted on    November-18-2012 11:55 PM

hi ashish,

given query solve your problem....

Dim db As Database
Dim i As Integer
    Set db = DBEngine.Workspaces(0).Databases(0)
    fExistTable = False
    db.TableDefs.Refresh
    For i = 0 To db.TableDefs.Count - 1
        If strTableName = db.TableDefs(i).Name Then
            'Table Exists
            fExistTable = True
            Exit For
        End If
    Next i


Ashish Pandey

Total Post:128

Points:898
Posted on    December-03-2012 8:38 AM

This is solve my problem!
Thanks Avadhesh

Modified On Apr-20-2016 01:36:29 AM

Don't want to miss updates? Please click the below button!

Follow MindStick