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
Else
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
    Do
        Debug.Print myRs.Fields("TABLE_NAME").Value
        myRs.MoveNext
    Loop Until myRs.EOF = True
End If
myRs.Close
myConn.Close
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!

thanx a ton.. it solved the issue...

Regards,
Vivek

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.