Azuraith
Azuraith

Reputation: 1050

Run-time error 3219 when trying dbs.OpenRecordset

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?

Upvotes: 1

Views: 2975

Answers (2)

Minty
Minty

Reputation: 1626

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.

Upvotes: 1

Azuraith
Azuraith

Reputation: 1050

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.

Upvotes: 2

Related Questions