strange behavior by deleting tables
- From: "Cesar Romani" <cesar_romani@xxxxxxxx>
- Date: Thu, 5 Apr 2007 23:39:27 +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: Paul Clement
- Re: strange behavior by deleting tables
- From: Ralph
- Re: strange behavior by deleting tables
- Prev by Date: Re: Open a ADODB.RecordSet from a Procedure
- Next by Date: Re: Precision on Output Parameter
- Previous by thread: Open a ADODB.RecordSet from a Procedure
- Next by thread: Re: strange behavior by deleting tables
- Index(es):
Relevant Pages
|