求助!
我想在acad中调用Access数据库,怎么办?我写了一个东东,但编译时有问题,说是用户自定义类型不对,Access数据库的调用,怎样进行初始化呀?请哪位高人帮忙说说。
为什么不行?
'打开文件对话框按钮代码Private Sub dir_Button_Click()
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
End Sub
以上程序为什么不能在table_box中增加选项?
班主帮我看看!
先看看二次开发栏目中的一篇文章,了解一下方法
http://www.mjtd.com/a2/list.asp?id=494我不打开表文件,只想访问数据库中所有表名,怎么办?
页:
[1]