Here is a function I wrote to check if a table exists in database or not:
''' <summary>
''' Checks to see if a table exists in Database or not.
''' </summary>
''' <param name="tblName">Table name to check</param>
''' <param name="cnnStr">Connection String to connect to</param>
''' <returns>Works with Access or SQL</returns>
''' <remarks></remarks>
Public Function DoesTableExist(ByVal tblName As String, ByVal cnnStr As String) As Boolean
'For reference on GetSchema see: http://msdn2.microsoft.com/en-us/library/ms254934(VS.80).aspx
'For Access Connection String, use "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & accessFilePathAndName
' Open connection to the database
Dim dbConn As New OleDbConnection(cnnStr)
dbConn.Open()
Dim restrictions(3) As String
restrictions(2) = tblName
Dim dbTbl As DataTable = dbConn.GetSchema("Tables", restrictions)
If dbTbl.Rows.Count = 0 Then
'Table does not exist
DoesTableExist = False
Else
'Table exists
DoesTableExist = True
End If
dbTbl.Dispose()
dbConn.Close()
dbConn.Dispose()
End Function