Gustav Brock
gustav at cactus.dk
Wed Mar 19 13:13:00 CST 2003
Hi Mark > Is there code to find out if an Access table exists in the database? Well, several options. This is one we use: <code> Function IsTable( _ ByVal strDatabase As String, _ ByVal strTable As String) As Boolean Dim dbs As Database Dim lngCount As Long Dim booFound As Boolean On Error GoTo Err_IsTable If Len(strDatabase) = 0 Then Set dbs = CurrentDb() Else Set dbs = DBEngine(0).OpenDatabase(strDatabase) End If lngCount = dbs.TableDefs.Count While lngCount > 0 And Not booFound booFound = (StrComp(dbs.TableDefs(lngCount - 1).Name, strTable, vbTextCompare) = 0) lngCount = lngCount - 1 Wend Set dbs = Nothing IsTable = booFound Exit_IsTable: Exit Function Err_IsTable: Resume Exit_IsTable End Function </code> Watch for a line break. /gustav