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

Check if Table Exists

Status
Not open for further replies.

darude

Programmer
Jun 23, 2003
138
US
Good Day All,
I just want to check if a local table (which actually gets imported) exists and can't find any information at all for that type of check.

Thank you for any help on this.
 
How about something like this?
Code:
Dim strSQL As String
On Error GoTo NoTable:
    strSQL = DLookup("FieldName", "TableName")

NoTable:
    If Err.Number = 3078 Then
        MsgBox "No such table"
    End If


Randy
 
You may use this function:
Code:
Function TableExists(strTableName As String) As Boolean
On Error Resume Next
TableExists = (CurrentDb.TableDefs(strTableName).Name = strTableName)
End Function

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 

Much better!
I suspected there was something like that but didn't know the method.


Randy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top