Problems binding form to ADO recordset that is using Batch Optimistic Locking (288375)
The information in this article applies to:
This article was previously published under Q288375 Advanced: Requires expert coding, interoperability, and multiuser
skills.
This article applies to a Microsoft Access database (.mdb) and to a
Microsoft Access project (.adp).
SYMPTOMS When you edit a record in a form that is bound to an
ActiveX Data Objects (ADO) recordset, you receive the following error message:
This recordset is not updateable. When you
close the form, you receive the following error message multiple times:
You can't save this record at this time.
Microsoft Access may have encountered an error while trying to save a record.
If you close this object now, the data changes you made will be lost. Do you
want to close the database object anyway? CAUSE This problem occurs when all the following conditions are
true:
- Microsoft Data Access Components (MDAC) 2.5 is installed on
your computer.
- The ADO connection used by the recordset was opened using
the Microsoft Access 10.0 OLE DB service provider and the Microsoft Jet OLE DB
data provider.
- The LockType property of the ADO recordset is set to the adLockBatchOptimistic constant.
RESOLUTIONInstall MDAC 2.6 on the Computer This problem has been corrected in MDAC 2.6. To resolve this
problem, upgrade your computer to MDAC 2.6. You can obtain the latest version
of MDAC from the following Microsoft Web site: To temporarily work around this problem, use the following
method. Change the ADO Connection to Only Use the Jet Provider You can work around this problem by opening the ADO connection
using only the Microsoft Jet 4.0 OLE DB data provider, and not the Microsoft
Access 10.0 OLE DB service provider. If you are writing your code in the
Microsoft Access user interface, set the ActiveConnection property of the ADO recordset to the CurrentProject.Connection property instead of to the CurrentProject.AccessConnection property. For example, the following code opens an ADO recordset
using only the Microsoft Jet 4.0 OLE DB data provider:
Private Sub Form_Open(Cancel As Integer)
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
With rs
Set .ActiveConnection = CurrentProject.Connection
.Source = "SELECT * FROM Customers"
.LockType = adLockBatchOptimistic
.CursorType = adOpenKeyset
.CursorLocation = adUseClient
.Open
Set .ActiveConnection = Nothing
End With
Set Me.Recordset = rs
End Sub
STATUS
Microsoft has confirmed that this is a problem in Microsoft Access.
REFERENCES
For more information about binding Access forms to ADO
recordsets, click the following article number to view the article in the Microsoft Knowledge Base:
281998
How to bind Microsoft Access forms to ADO recordsets
For more information about the difference between the Connection and
the AccessConnection properties, click the following article number to view the article in the Microsoft Knowledge Base:
281784
Difference between Connection and AccessConnection properties
Modification Type: | Minor | Last Reviewed: | 3/7/2006 |
---|
Keywords: | kbbug kbdta kberrmsg kbnofix KB288375 |
---|
|