首页 > 解决方案 > 在 QueryDefs 中找不到 RecordsetType 属性作为有效属性

问题描述

我正在尝试将我的查询锁定在我的 MS Access 2016 前端,以便用户只能看到查询的快照,而无法编辑 SQL 代码或查询中的数据。但是我的 VBA 代码遇到了问题:

'Lock queries
For Each oQD In CurrentDb.QueryDefs
    'If Left(oQD.Name, 3) = "qry" Then
    If Left(oQD.Name, 1) <> "~" Then
        Set oProp = oQD.Properties("RecordsetType")
        If Err Then
            Set oProp = oQD.CreateProperty("RecordSource", dbText, "Snapshot")
            oQD.Properties.Append oProp
        Else
            oProp.Value = 2
        End If
    End If
Next oQD

返回运行时错误“3270”:找不到“RecordsetType”的属性。有人能帮忙吗?

标签: vbams-access

解决方案


推荐阅读