问题
Normally I use ADODB recordsets and database connections, but i am required to use DAO record sets for the first time due to some limitations of ADO. I am attempting to create a recordset and i am receiving error 3219 - Invalid Operation.
Here is all my DAO database code.
Dim dbsTrace As DAO.Database
Dim rsTrace As DAO.Recordset
Set dbsTrace = CurrentDb
Set rsTrace = dbsTrace.OpenRecordset("TRACE", dbOpenTable)
The error is throwing on the last line. This code was taken directly from the msdn.microsoft website and then modified to include my table name...
Thoughts?
回答1:
If you are only need the table in a read only recordset simply use dbOpenSnapshot, this will give you a un-editable recordset copy at the time.
回答2:
Had to change dbOpenTable to dbOpenDynaset. Credit to Kostas K. in comments.
NOTE: Also had to add dbSeeChanges option due to the fact that i was using a sql server table connection.
来源:https://stackoverflow.com/questions/44050212/run-time-error-3219-when-trying-dbs-openrecordset