In the Module1 module of the attached file I've prepared DAO (CheckTables) and ADO (CheckTable) versions of a function that determines whether a table exists.
I've run them against the Italgen table but only the DAO version correctly determines that the table exists.
What's wrong with the ADO version?
<font color=red>
Function CheckTables(strTable) As Boolean
On Error GoTo ErrorHandler
Set dbs = CurrentDb
Set tdf = dbs.TableDefs(strTable)
CheckTables = True
ErrorHandlerExit:
Exit Function
ErrorHandler:
If Err = 3265 Then
CheckTables = False
Resume ErrorHandlerExit
Else
MsgBox "Error No: " & Err.Number & "; Description: " & Err.Description
Resume ErrorHandlerExit
End If
End Function
</font color=red><font color=448800>
Function CheckTable(strTable) As Boolean
On Error GoTo ErrorHandler
Dim cat As New ADOX.Catalog
Set cnn = CurrentProject.Connection
Set tbl = cat.Tables(strTable)
CheckTable = True
ErrorHandlerExit:
Exit Function
ErrorHandler:
If Err = 3265 Then
CheckTable = False
Resume ErrorHandlerExit
Else
MsgBox "Error No: " & Err.Number & "; Description: " & Err.Description
Resume ErrorHandlerExit
End If
End Function</font color=448800>




