明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1318|回复: 4

求助!

[复制链接]
发表于 2003-6-19 21:29:00 | 显示全部楼层 |阅读模式
我想在acad中调用Access数据库,怎么办?
我写了一个东东,但编译时有问题,说是用户自定义类型不对,Access数据库的调用,怎样进行初始化呀?请哪位高人帮忙说说。
 楼主| 发表于 2003-6-19 22:32:00 | 显示全部楼层

为什么不行?

'打开文件对话框按钮代码

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中增加选项?
 楼主| 发表于 2003-6-20 13:45:00 | 显示全部楼层

班主帮我看看!

发表于 2003-6-20 16:10:00 | 显示全部楼层

先看看二次开发栏目中的一篇文章,了解一下方法

http://www.mjtd.com/a2/list.asp?id=494
 楼主| 发表于 2003-6-20 21:06:00 | 显示全部楼层

我不打开表文件,只想访问数据库中所有表名,怎么办?

您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-9-28 03:23 , Processed in 0.186325 second(s), 24 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表