记录无法读取;没有“MSysObjects”的读取权限 [英] Record cannot be read; no read permission on 'MSysObjects'

查看:1127
本文介绍了记录无法读取;没有“MSysObjects”的读取权限的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图从Access 2007 ACCDB格式数据库中使用Excel VBA获取所有表的列表。

I'm trying to get a list of all tables from an Access 2007 ACCDB format database using Excel VBA.

我已经遵循了这个职位:

I have followed this post:

如何从MS Access数据库?

使用:

SELECT MSysObjects.Name AS table_name
FROM MSysObjects
WHERE
        (((Left([Name],1))<>"~")
    AND ((Left([Name],4))<>"MSys")
    AND ((MSysObjects.Type) In (1,4,6)))
order by MSysObjects.Name

但我收到此错误。


无法读取记录;没有对'MSysObjects'的读取权限

Record cannot be read; no read permission on 'MSysObjects'

我想只能使用SQL语句而不是 OpenSchema 方法。

I want to be able to get the table names only using a SQL statement and not the OpenSchema method.

我认为问题是Access。我不确定。

I think the problem is with Access. I'm not sure.

有人有任何想法吗?

推荐答案

p>由于您的数据库是ACCDB格式,因此您将以用户管理员的身份工作。您可以在立即窗口中确认该点。 (使用 Ctrl + g

Since your db is ACCDB format, you will be working as user Admin. You can confirm that point in the Immediate window. (Go there with Ctrl+g)

? CurrentUser()
Admin

由于管理员没有在 MSysObjects 中读取( SELECT )权限,执行DDL语句以给予该权限管理

Since Admin doesn't have read (SELECT) permission on MSysObjects, execute a DDL statement to give Admin that permission.

strDdl = "GRANT SELECT ON MSysObjects TO Admin;"
CurrentProject.Connection.Execute strDdl

这篇关于记录无法读取;没有“MSysObjects”的读取权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆