一组判断对象是否存在数据库中的模块 ----判断查询是否存在------------------ Function IsQueryInDatabase(strQueryName As String) As Integer
Dim db As DAO.Database Dim I As Integer Set db = CurrentDb IsQueryInDatabase = False db.QueryDefs.Refresh For I = 0 To db.QueryDefs.Count - 1 If strQueryName = db.QueryDefs(I).Name Then '查询存在 IsQueryInDatabase = True Exit For End If Next I Set db = Nothing
End Function '----判断表是否存在------------------ Function IsTableInDatabase(strTableName As String) As Integer
Dim db As DAO.Database Dim I As Integer Set db = CurrentDb IsTableInDatabase = False db.TableDefs.Refresh For I = 0 To db.TableDefs.Count - 1 If strTableName = db.TableDefs(I).Name Then '表存在 IsTableInDatabase = True Exit For End If Next I Set db = Nothing
End Function '----判断窗体是否存在------------------ Function IsFormInDatabase(strFormName As String) As Integer
Dim dbCurrent As DAO.Database Dim strname As String