Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Looping Through Tables in Access? 1

Status
Not open for further replies.

Phoenix22

Technical User
Sep 23, 2003
29
CA
Hi,

Could someone please tell me the VBA code I could use to loop through a series of tables of Access? Thank you in advance for your time and help.
 
Take a look at AllTables

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
Hi Phoenix

This snippet look throught all the tables in your database, and in my case deletes a table called HRLOG1. Hope this helps.

Code:
Dim dbs_Current As Database
Dim Table_Exist As TableDef

Set dbs_Current = CurrentDb

With dbs_Current
  Set Table_Exist = .CreateTableDef()

  For Each Table_Exist In .TableDefs
       Debug.Print "  " & Table_Exist.Name
     If Table_Exist.Name = "HR_LOG1" Then
        Me!Text_Box.Visible = True
        Me!Text_Box = "Deleted Existing Table..........."
        Me.Repaint
        .TableDefs.Delete "HR_LOG1"
        End If
  Next Table_Exist
End With
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top