K
Katrina
I have the function below to delete all tables from
another database (file.mdb) this command will delete all
the tables without relationships, but I need it to delete
all the tables, including the ones with relationships.
How can I fix this?
Thanks in advance for your help.
Function deletea()
Dim f
Set fs = CreateObject("scripting.filesystemobject")
Set f = fs.getfile("C:\file.mdb")
f.Attributes = 0
Dim dbSource As DAO.Database
Dim tdf As Object
Dim strSourceDB As String
strSourceDB = f
Set dbSource = DBEngine.OpenDatabase(strSourceDB)
For Each tdf In dbSource.TableDefs
If Left(tdf.NAME, 4) <> "MSys" Then
dbSource.TableDefs.delete tdf.NAME
Else
End If
Next tdf
f.Attributes = 1
dbSource.Close
Set dbSource = Nothing
End Function
another database (file.mdb) this command will delete all
the tables without relationships, but I need it to delete
all the tables, including the ones with relationships.
How can I fix this?
Thanks in advance for your help.
Function deletea()
Dim f
Set fs = CreateObject("scripting.filesystemobject")
Set f = fs.getfile("C:\file.mdb")
f.Attributes = 0
Dim dbSource As DAO.Database
Dim tdf As Object
Dim strSourceDB As String
strSourceDB = f
Set dbSource = DBEngine.OpenDatabase(strSourceDB)
For Each tdf In dbSource.TableDefs
If Left(tdf.NAME, 4) <> "MSys" Then
dbSource.TableDefs.delete tdf.NAME
Else
End If
Next tdf
f.Attributes = 1
dbSource.Close
Set dbSource = Nothing
End Function