I have the following vba to check if a table exists, but I can not find on the net how to check if a form exists, I tried to modify this script but there does not seem to be a formdef
Code:
Sub table_Exists()
Dim dbs As Database
Dim tbl As TableDef
Dim dbsExist As Object
Dim tablename As String
tablename = "Table2" ' Your Table Name
Dim exists As String
Set dbs = CurrentDb
Set dbsExist = dbs.TableDefs
'--------------------------------------------------------------
' Search for AccessObject objects in AllTables collection.
For Each tbl In dbsExist
If tbl.Name = tablename Then
MsgBox "Table Exists"
exists = True
GoTo Part2
End If
Next tbl
Part2:
If exists = "True" Then
Exit Sub
Else
MsgBox "Table Does Not Exists"
End If
Set dbsExist = Nothing ' Clean up
End Sub