04 RsetOpen - AndrewMB2/Logic-Architect-for-Excel-VBA GitHub Wiki

RsetOpen method

Opens a recordset using a SQL statement. Returns True if successful, otherwise False.

Applies to

TableData ArrData RsetData Xdata XShared

Parameters

Name Type Description
SQL String SQL SELECT statement to query the database.
CursorType adCursorType enumeration (optional) Cursor type - the default is adOpenStatic (but see below). Only Static and Keyset cursors are supported, the other types do not set the record count. For more information see this Microsoft web page.
LockType adLockType enumeration (optional) Lock type - the default is adLockOptimistic which is sufficient for most purposes. For more information see this Microsoft web page.
CacheSize Variant (optional) Cache size. Can normally be ignored. For more information see this Microsoft web page.
Silent Boolean (optional) If True, any error message is output in the VBA immediate pane rather than to the user.

The RsetData object must have first been connected to a database.

Only Static and keyset cursors are supported, the other types do not set the record count. If the cursor location is Client, a static cursor is opened. If the cursor location is Server, ADODB cannot open a Static cursor so opens a Keyset cursor instead. For more information see the Microsoft web page referenced above.

If the method fails, the error number is stored in the RsetData object's ErrNumber property.