Name

Recordset.Source Property — (Versions 2.0, 2.1, 2.5, 2.6)

Synopsis

                     recordset.Source = source
                  

The Source property returns the source for the data in a Recordset object.

Datatype

String (Let, Get)
Command (Set)

Description

For a Recordset object, the Source property specifies from where a recordset’s data comes. The Source property for the Recordset object is read- and write-enabled while the Recordset object is closed, but read-only once it is opened.

The value of the Source property for the Recordset object can contain one of the following:

  • Command object variable

  • SQL statement

  • Stored procedure name

  • Table name

  • File or URL

If the Source property is set to a Command object, the ActiveConnection property of the Recordset object gets its value from the ActiveConnection property of the Command object, but reading the Source property does not return a Command object. Instead, it returns the CommandText property of the associated Command object from which you set the Source property.

If the Source property is set to a SQL statement, a stored procedure name, or a table name, you would be better off specifying it in the Options argument of the Open method, in order for the Recordset object to optimize performance.

See Also

Recordset.Open Method

Get ADO: ActiveX Data Objects now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.