Office中国论坛/Access中国论坛

标题: [求助]ADO视图(VIEWS)如何删除 [打印本页]

作者: 阿丰    时间: 2004-11-10 17:17
标题: [求助]ADO视图(VIEWS)如何删除
有以下代码:

Public Sub 删除查询()

On Error GoTo Err_错误_Click

Dim cat  As New ADOX.Catalog, v As ADOX.View

Set cat.ActiveConnection = CurrentProject.Connection

cat.Views.Refresh

For Each v In cat.Views

     If v.Name = "_table" Then cat.Views.Delete "_table"

Next

Set cat.ActiveConnection = Nothing

Set cat = Nothing

Exit_错误_Click:

  Exit Sub

Err_错误_Click:

  MsgBox Err.Description

  Resume Exit_错误_Click

End Sub

运行时出错,提示找不到项目名。应如何改正?
作者: cg1    时间: 2004-11-10 19:42
关于此主题请参考:

    只用ado列出所有的表《ADO/DAO》

    http://access911.net/index.asp?u1=a&u2=72FAB71E14DC

删除视图用 currentproject.connection.execute "DROP VIEW .... "




欢迎光临 Office中国论坛/Access中国论坛 (http://www.office-cn.net/) Powered by Discuz! X3.3