且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何检查MS Access for vb宏中是否存在表

更新时间:2023-12-01 08:20:46

设置对Microsoft Access 12.0对象库的引用可以使我们使用DCount测试表是否存在.

Setting a reference to the Microsoft Access 12.0 Object Library allows us to test if a table exists using DCount.

Public Function ifTableExists(tblName As String) As Boolean

    If DCount("[Name]", "MSysObjects", "[Name] = '" & tblName & "'") = 1 Then

        ifTableExists = True

    End If

End Function