function isTable(cName as string) as boolean
dim td as tabledef
on error resume next
set td=currentdb.tabledefs(cname)
isTable=(err=0)
set td=nothing
end function
From a post dated 2/12/2004 by Access MVP Ken Snell:
This function will return a true value if the table exists in the database;
false if not.
Public Function TableIsHere(strTableName As String) As Boolean
Dim tdf As TableDef
TableIsHere = False
For Each tdf in CurrentDb.TableDefs
If tdf.Name = strTableName Then TableIsHere = True
Next tdf
End Function
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.