'本例用DAO查找数据库中某一表是否存在。
Function fExistTable(strTableName As String) As Integer
Dim db As Database
Dim i As Integer
Set db = DBEngine.Workspaces(0).Databases(0)
fExistTable = False
db.TableDefs.Refresh
For i = 0 To db.TableDefs.count - 1
If strTableName = db.TableDefs(i).name Then
'Table Exists
fExistTable = True
Exit For
End If
Next i
Set db = Nothing
End Function
Private Sub 命令0_Click()
MsgBox fExistTable("kk")
End Sub