"Object variable or With block variable not set" error message when you use Delete or UpdateBatch methods (287485)
The information in this article applies to:
- Microsoft Office Access 2003
- Microsoft Access 2002
This article was previously published under Q287485 Moderate: Requires basic macro, coding, and interoperability
skills.
This article applies to a Microsoft Access database (.mdb) and to a
Microsoft Access project (.adp).
SYMPTOMS When you use code that performs Delete and UpdateBatch methods based on the Forms collection, you receive the following error message:
Microsoft Visual Basic
Run-time error
'91': Object variable or With block variable not set
RESOLUTION Make sure the Recordset object is not based on the form's recordset if you plan to use
the Delete or UpdateBatch methods. For an example, see the following code:
Sub Test()
Dim rs As New ADODB.Recordset
rs.Open "SELECT * FROM TableX", CurrentProject.Connection, _
adOpenKeyset, adLockOptimistic
rs.Delete
rs.UpdateBatch
End Sub
STATUSMicrosoft
has confirmed that this is a problem in the Microsoft products that are listed
at the beginning of this article.
Modification Type: | Minor | Last Reviewed: | 7/28/2006 |
---|
Keywords: | kbfunctions KbVBA kbProgramming kbbug kberrmsg kbpending KB287485 |
---|
|