Source Property

Settings and Return Values

Remarks

Use the Source property on a Recordset object to determine from where the Recordset object's data comes, or on an Error object to create error-handling routines.

Recordset

Use the Source property to specify a data source for a Recordset object using one of the following: a Command object variable, an SQL statement, a stored procedure, or a table name. The Source property is read/write for closed Recordset objects and read-only for open Recordset objects.

If the Source property specifies a Command object, the ActiveConnection property of the Recordset object will inherit the value of the ActiveConnection property for the specified Command object. If the Source property is an SQL statement, a stored procedure, or a table name, you can optimize performance by passing the appropriate Options argument with the Open method call.

Error

Use the Source property on an Error object to determine the name of the object or application that originally generated an error. This could be the object's class name or programmatic ID. For errors in ADODB, the property value will be ADODB.ObjectName where ObjectName is the name of the object that triggered the error. The Source property is read-only for Error objects.

Based on the error documentation from the Source, Number, and Description properties of Error objects, you can write code that will handle the error appropriately.