|
因有网友提问关于这方面的问题,所以本人写了两个检测表是否存在的一个自定义函数,注明未测试,仅供参考
'*********************************
'自定义函数一
'*********************************
Public Function Btbl (strTblName As String) As Boolean
Dim I As Integer
Dim tdf As TableDef
Btbl=False
'遍历所有表,判断指定表名是否存
For I = 0 To CurrentDb.TableDefs.Count - 1
If CurrentDb.TableDefs(I).Name = strTblName Then
Btbl =True '存在则真
Exit for
End If
Next I
'End Function
'*****************************
'自定义函数二
'*****************************
Public Function Btbl (strTblName As String) As Boolean
Dim I As Integer
Dim tdf As TableDef
Dim M_Count As Intrger
'遍历所有表,判断指定表名是否存
For I = 0 To CurrentDb.TableDefs.Count - 1
If CurrentDb.TableDefs(I).Name = strTblName Then
M_count=M_count+1
Exit for
End if
Next I
'输出值真则存,假则不存在
If M_count > 0 then
Btbl = True
Else
Btbl = False
End if
End Function
|站长邮箱|小黑屋|手机版|Office中国/Access中国 ( 粤ICP备10043721号-1 )
GMT+8, 2024-5-26 01:42 , Processed in 0.068605 second(s), 14 queries .
Powered by Discuz! X3.3
© 2001-2017 Comsenz Inc.