Published in: Visual Basic
Function ObjectExists(ObjectType As String, ObjectName As String) As Boolean Dim obj As AccessObject Select Case ObjectType Case "Table" For Each obj In CurrentData.AllTables If obj.Name = ObjectName Then ObjectExists = True Exit For End If Next obj Case "Query" For Each obj In CurrentData.AllQueries If obj.Name = ObjectName Then ObjectExists = True Exit For End If Next obj Case "Form" For Each obj In CurrentProject.AllForms If obj.Name = ObjectName Then ObjectExists = True Exit For End If Next obj Case "Report" For Each obj In CurrentProject.AllReports If obj.Name = ObjectName Then ObjectExists = True Exit For End If Next obj End Select End Function
You need to login to post a comment.
