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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBA Access Table check

Status
Not open for further replies.

thegameoflife

Programmer
Dec 5, 2001
206
US
Is it possible in Access to use code to check for existence of a table?

If so do you have an example?
 
Hi!

Probably the simplest way is to try to open the table and trap the error that occurs (probably Object does not exist you can do tests to find out). You can then run code or print a message depending on why you are checking.

hth
Jeff Bridgham
bridgham@purdue.edu
 
Here is how you do it in code


Code:
Sub listaccesstables()
Dim catdb As ADOX.Catalog
Dim tblList As ADOX.Table

Set catdb = New ADOX.Catalog

catdb.ActiveConnection = CurrentProject.Connection


For Each tblList In catdb.Tables
    If tblList.Name = "Chip_Extract" Then
        MsgBox tblList.Name
    End If
Next

Set catdb = Nothing


End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top