Dim FileName As String
Dim title As String
title = "打开文件..."
Dim filter As String
filter = "目录数据库文件(*.mdb)" & vbNullChar & "*.mdb"
FileName = GetFile(title, filter)
ACDTmainForm.Filename_TextBox.Text = FileName
'导入表名
If FileName <> nil Then
Dim Appaccess As Access.Application
Dim accessdbs As Object
Dim accesstable As AccessObject
Dim name_str As String
Dim array_name As Variant
On Error Resume Next
Set Appaccess = New Access.Application
Appaccess.OpenCurrentDatabase FileName
If Err.Number <> 0 Then
MsgBox ("数据库文件错误,请再试一次!")
Err.Clear
End If
For Each accesstable In accessdbs.AllTables
ACDTmainForm.table_Box.AddItem accessdbs.Name
Next accesstable
Appaccess.CloseCurrentDatabase
Set Appaccess = Nothing
Else
Exit Sub
End If