Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Function ObjectExists(ObjType As Integer, ObjName As String) As Boolean
'Determines whether or not a given object exists in database
'If ObjectExists(acTable, "tblOrders") then ...
Dim strTemp As String
Dim db As Database
Dim strContainer As String
On Error Resume Next
Set db = CurrentDb()
Select Case ObjType
Case acTable
strTemp = db.TableDefs(ObjName).Name
ObjectExists = (Err.Number = 0)
Case acQuery
strTemp = db.QueryDefs(ObjName).Name
ObjectExists = (Err.Number = 0)
Case acMacro, acModule, acForm, acReport
Select Case ObjType
Case acMacro
strContainer = "Scripts"
Case acModule
strContainer = "Modules"
Case acForm
strContainer = "Forms"
Case acReport
strContainer = "Reports"
End Select
strTemp = db.Containers(strContainer).Documents(ObjName).Name
ObjectExists = (Err.Number = 0)
End Select
End Function
Function QueryExists(QueryName as String) As Boolean
QueryExists = False
Dim objQuery As AccessObject
For Each objQuery In Application.CurrentData.AllQueries
If objQuery.Name = QueryName Then QueryExists = True
Next
End Function
If QueryExists(
QueryName
) Then ...