|
If TableExists(strTableName) Then MsgBox strTableName & " found." _
Else MsgBox strTableName & " Not found." '___________________________________________________________ Private Function TableExists(TableName) As Boolean Dim dbMyDB As Database Dim rsTemp As Recordset On Error Goto NotFound If TableName <> "" Then Set rsTemp = _ dbMyDB.OpenRecordset(TableName) 'If the RS fails, it will quickly pass over the 'true statement below. TableExists = True NotFound: End Function '___________________________________________________________ 'I have VERY often seen people use the standard routine of 'going through EACH and EVERY table comparing each one till 'they get the the end, as in For Each MyTable in DB.TableDefs if MyTable.Name = strNameImLookingFor then TableExists = true Exit For end if Next |