如何检查 MS Access 中是否存在用于 vb 宏的表 [英] How to check if a table exists in MS Access for vb macros
本文介绍了如何检查 MS Access 中是否存在用于 vb 宏的表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
可能的重复:
检查访问表是否存在
我是 vba 宏的新手.知道如何检查表是否存在吗?我已经搜索了以前的帖子,但没有得到明确的解决方案.
I'm new to vba macros. Any idea how to check if a table exists or not? I have searched for previous posts but did not get a clear solution for this.
推荐答案
设置对 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
这篇关于如何检查 MS Access 中是否存在用于 vb 宏的表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文