adOpenStatic Logo
Navigation
Home
FAQ
Ken's Blog
Resources
Contact Ken
Copyright 2000 -



This error usually takes the form:

ADODB.Recordset error '800a0bb9'

Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.

There are a number of possible causes - most are esoteric and are related to problems with Visual InterDev Design Time Controls. If you are using DTCs you may wish to look at the following:

  • Q259388 - 800a0bb9 Error Occurs With Data Bound Design-Time Control
  • Q197323 - ADODB.Connection Error 800a0bb9 When Using Recordset DTC

Another cause of the problem can result from the incorrect application of a filter to an already open recordset. If you are in this situation you may wish to look at:

  • Q235892 - 800a0bb9 Error Message When Applying a Filter to an ADO Recordset

However by far the most common cause of 0x800a0bb9 errors results when you try to use the ADO Recordset's Open method. The most common cause is the passing of incorrect, conflicting or malformed parameters to the .Open method.

Since there is a lot of ground to cover I've divided dealing with this error into several parts. The rest of this page deals with the .Open method's syntax. If you do not have a solid understanding of the .Open method it is recommended that you read it. Subsequent pages deal with:

  • Step 1 - Checking for syntactic and spelling mistakes
  • Step 2 - Defining the ADO constants
  • Step 3 - Making sure your cursor and locktypes are not conflicting

The Recordset's Open Method
the ADO Recordset's Open method accepts the following parameters:

objRS.Open sourceconnection, [cursortype], [locktype], [options]

where the [ ] indicates optional parameters.

Source: is an SQL Statement, a variable containing an SQL statement, the name of table within the database or the name of a stored procedure. If you are passing an SQL statement, a tablename or the name of a stored procedure the source must be enclosed in " marks.

Connection: is a valid ADO Connection String or a variable containing a connection string. You can also pass in a valid existing ADO Connection object. If you are passing in a connection string you need to enclose it in " marks.

CursorType:can be one: adOpenForwardOnly (default), adOpenStatic, adOpenDynamic, adOpenKeyset

LockType: can be one of: adLockReadOnly (default), adLockOptimistic, adLockPessimistic, adLockBatchOptimistic

Options can be any valid options. By far the most commonly passed in is an option to indicate the type of Source you are using eg adCmdText (for an SQL Statement), adCmdTable (if you want ADO to construct an SQL statement to get all the rows in a table), adCmdTableDirect (if you want to directly retrieve all the rows in a table - from ADO 2.5 onwards) or adCmdStoredProc (if you are accessing a stored procedure). If you do not specify the type of source then adCmdUnknown is used as the default.

Example of the correct use of the Recordset's Open method would be:

strSQL = "SELECT field1, field2 FROM table1"
strConnect = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\db1.mdb"
objRS.Open strSQL, strConnect, adOpenForwardOnly, adLockReadOnly, adCmdText

- or -

strConnect = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\db1.mdb"
objRS.Open "table1", strConnect, adOpenForwardOnly, adLockReadOnly, adCmdTable

Step 1 - syntactic and spelling mistakes.
Back to FAQ listing.