Run-time error 3219 when trying dbs.OpenRecordset

旧巷老猫 提交于 2019-12-12 07:03:15

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!