Hi - Can anyone give me any pointers on how I can check to see if a table exists. I have some code that creates a table but if the table exists already I get an error message. I want to be able to check before the make table code is run.
If IsTable("tblMyStuff") Then
' do stuff
Else
' do other stuff
End If
Code:
Public Function IsTable(ByVal strTable As String) As Boolean
On Error GoTo Err_IsTable
Dim db As DAO.Database
Dim tdf As DAO.TableDef
Set db = CurrentDb
If db.TableDefs(strTable).Name <> "" Then
IsTable = True
End If
Exit_IsTable:
Set tdf = Nothing
Set db = Nothing
Exit Function
Err_IsTable:
IsTable = False
Resume Exit_IsTable
End Function