Group:  Microsoft Access ยป microsoft.public.access.externaldata
Thread: Delete a table in a different database

DotNetBag
.NET Development Newsgroups

HTVi
TV Discussion Newsgroups

Our Hot Pick: Rising Antivirus 2006 - Certified by TUV & Checkmark! Get 10% discount by entering this coupon code: ONDISCOUNT10
Rising Antivirus 2006

Delete a table in a different database
Steve 14.07.2006 19:31:02
Good day.

Looking for some code that will delete all the tables from a different
database than the one that the code is running in. In other words, open an
..mdb, click a button and delete all the tables from a different database on
the server.

Any ideas? Thank you.
Re: Delete a table in a different database
"Rick Brandt" <rickbrandt2[ at ]hotmail.com> 14.07.2006 19:56:51
Steve wrote:
[Quoted Text]
> Good day.
>
> Looking for some code that will delete all the tables from a different
> database than the one that the code is running in. In other words,
> open an .mdb, click a button and delete all the tables from a
> different database on the server.
>
> Any ideas? Thank you.

(air code)

Sub KillTables()

Dim db As Database
Dim tbl As TableDef
Dim i As Integer

Set db = Workspaces(0).OpenDatabase("Path To Other MDB")

For i = db.TableDefs.Count - 1 To 0
Set tbl = db.TableDefs(i)
db.TableDefs.Delete tbl.Name
Next i

End Sub

--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com


Home | Search | Terms | Imprint | Contact
Newsgroups Reader - provided by WiredBox.Net