B Bas Cost Budde Dec 13, 2004 #2 Jim said: What's the easiest way to do this, especially for a table? Click to expand... Easiest... dunno A97, air code function TableExists(cName as string)as boolean on error resume next dim td as tabledef set tb=currentdb.tabledefs(cName) tableexists = err<>0 end function
Jim said: What's the easiest way to do this, especially for a table? Click to expand... Easiest... dunno A97, air code function TableExists(cName as string)as boolean on error resume next dim td as tabledef set tb=currentdb.tabledefs(cName) tableexists = err<>0 end function
P Paul Overway Dec 13, 2004 #3 Try to open the TableDef for the table in question. If you get an error, the table doesn't exist.
J John Mishefske Dec 14, 2004 #4 Jim said: What's the easiest way to do this, especially for a table? Click to expand... Private Function tableExist(sName As String) As Boolean Dim tdf As DAO.TableDef tableExist = False For Each tdf In CurrentDb.TableDefs If tdf.Name = sName Then tableExist = True End If Next tdf End Function Make sure you have a reference to the DAO object model. '--------------- ' John Mishefske '---------------
Jim said: What's the easiest way to do this, especially for a table? Click to expand... Private Function tableExist(sName As String) As Boolean Dim tdf As DAO.TableDef tableExist = False For Each tdf In CurrentDb.TableDefs If tdf.Name = sName Then tableExist = True End If Next tdf End Function Make sure you have a reference to the DAO object model. '--------------- ' John Mishefske '---------------