[AccessD] A2K:ADO Version of the following

DWUTKA at marlow.com DWUTKA at marlow.com
Mon Feb 23 11:26:32 CST 2004


Sure, use this:

Function RemoveLinkedTables(strPath As String)
Dim cnn As New ADODB.Connection
Dim rs As New ADODB.Recordset
cnn.Provider = "Microsoft.JET.OLEDB.4.0"
cnn.Open "D:\Databases\AccessD.mdb"
Set rs = cnn.OpenSchema(adSchemaTables)
rs.MoveFirst
Do Until rs.EOF = True
    If rs.Fields("TABLE_TYPE") = "LINK" Then
        cnn.Execute "DROP Table " & rs.Fields("TABLE_NAME")
    End If
    rs.MoveNext
Loop
rs.Close
Set rs = Nothing
cnn.Close
Set cnn = Nothing
End Function
 

Drew

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com]On Behalf Of Darren DICK
Sent: Monday, February 23, 2004 4:40 AM
To: AccessD List
Subject: [AccessD] A2K:ADO Version of the following


Hello all
I have a nice bit of code (Thanks Deano) that drops all the linked tables in
a dB - cool
Does anyone know the ADO version of the code below?

Many thanks

Darren

""""""""""""""""""""""""""""""""""""""""""""""
 Dim lnk As DAO.tabledef
  
    For Each lnk In CurrentDb.TableDefs
        If lnk.Attributes = dbAttachedTable Then
            CurrentDb.TableDefs.Delete lnk.Name
        End If
    Next
_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com



More information about the AccessD mailing list