'Change Recordset Type via VBA [duplicate]

I have a MS-Access database, which includes several queries, which have the recordset type Dynaset. I want to change all Queries to the Recordset Type Snapshot (i.e. dbOpenSnapshot).

Following approach gives me the error message that dbOpenSnapshot is not a valid argument, which I took from here

Sub Properties()
Dim dbs As DAO.Database
Dim rsQuery As DAO.RecordSet
    
Set dbs = CurrentDb

Set rsQuery = dbs.OpenRecordset("Query1")
rsQuery.Properties("Type") = dbOpenSnapshot

End Sub

Thank you for any hints!



Solution 1:[1]

This is the syntax:

Set rsQuery = dbs.OpenRecordset("Query1", dbOpenSnapshot, dbReadOnly)

Database.OpenRecordset

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1