在 Access VBA 中,将记录集作为快照打开时,是否使只读选项变得多余?起初,这似乎是真的,因为快照基本上已经是只读的,但似乎总是有警告。
例:
Dim acc as Access.Application
Dim db as DAO.Database
Dim rs as DAO.Recordset
Dim sqltext as String
sqltext = "SELECT * FROM SOMESOURCE"
Set rs = db.OpenRecordset(sqltext, dbOpenSnapshot, dbReadOnly)
'Because the type is dbOpenSnapshot, does dbReadOnly become redundant?
检查记录集的Updatable
属性。 这个打印假。
sqltext = "SELECT * FROM TABLE_01"
Set db = CurrentDb
Set rs = db.OpenRecordset(sqltext, dbOpenSnapshot)
Debug.Print rs.Updatable
因此,是的,dbOpenSnapshot
,因为记录集类型选项为您提供了只读记录集。