alekm said:
Hi,
how can I determine, through code, whether table_temp exists in my
database
(or it is already deleted)?
Thanx
alek_mil
Paste the function into a new module, make sure you have a reference to the
DAO object library and make sure you compile the code. Then you use it as
shown below:
If TableExists("table_temp") Then
MsgBox "It exists"
Else
MsgBox "It doesn't exist"
End If
Function TableExists(strTableName As String) As Boolean
On Error GoTo Err_Handler
Dim dbs As DAO.Database
Dim tdf As DAO.TableDef
Set dbs = CurrentDb
For Each tdf In dbs.TableDefs
If tdf.Name = strTableName Then
TableExists = True
Exit For
End If
Next tdf
Exit_Handler:
On Error Resume Next
Set tdf = Nothing
Set dbs = Nothing
Exit Function
Err_Handler:
MsgBox Err.Description, vbExclamation, "Error No: " & Err.Number
Resume Exit_Handler
End Function