Hi..actually am stuck up at a place while converting my current projet from DAO to ADO. As there is no equivalent function for Tabledef in ADO..thus i cant figure it out, as to how to replace the following code with.

The following code searches for the table with name "BlockTable". If it finds the table, flag is set to TRUE, else False.

Dim tdf as TableDef

For Each tdf In db.TableDefs
If UCase(tdf.Name) = UCase("Blocktable") Then
l_flgtab = True
Exit For
l_flgtab = False
End If
Next tdf

PLzzz help me out...

You can use this code snippet to help you out:

Dim myConn As ADODB.Connection
Dim myRs As ADODB.Recordset
Set myConn = New ADODB.Connection
myConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=MyDatabase.mdb;Persist Security Info=False"

Set myRs = myConn.OpenSchema(adSchemaTables)

If myRs.EOF = False Then
        Debug.Print myRs.Fields("TABLE_NAME").Value
    Loop Until myRs.EOF = True
End If
Set myRs = Nothing
Set myConn = Nothing

Note that you'll have to be sure and change the connection string to point to the database you're interested in. Keep in mind too that this will also return the names of ALL the tables in your Access database (including the system tables) so you'll have to test inside the DO..LOOP construct and exit as appropriate.

Hope this helps! Good luck!

This question has already been answered. Start a new discussion instead.