strange behavior by deleting tables
- From: "Cesar Romani" <cesar_romani@xxxxxxxx>
- Date: Fri, 6 Apr 2007 15:13:05 +0200
I've written the following code to delete all tables of a ms access db.
It deletes only half the number of tables not all.
----------------------------------------
1. Sub deleteTables()
2. Dim cat As New ADOX.Catalog
3. Dim tbl As ADOX.Table
4.
5. cat.ActiveConnection = CurrentProject.Connection
6.
7. For Each tbl In cat.Tables
8. If tbl.Type = "TABLE" Then
9. cat.Tables.Delete tbl.Name
10. End If
11. Next
12.
13. Set tbl = Nothing: Set cat = Nothing
14. End Sub
------------------------------------------
If I change the line 9. with
DoCmd.DeleteObject acTable, tbl.Name
the modified code deletes all tables. Why is it so?
Many thanks in advance,
Cesar
.
- Follow-Ups:
- Re: strange behavior by deleting tables
- From: Rick Brandt
- Re: strange behavior by deleting tables
- Prev by Date: Re: News Server?
- Next by Date: Re: strange behavior by deleting tables
- Previous by thread: why do i get a key conflict when I add a record to a linked table?
- Next by thread: Re: strange behavior by deleting tables
- Index(es):
Relevant Pages
|