Open Method (ADO Record)

Microsoft ActiveX Data Objects (ADO)

ADO 2.5 API Reference

Open Method (ADO Record)

Opens an existing Record object, or creates a new item represented by the Record (such as a file or directory).

Syntax

Open Source, ActiveConnection, Mode, CreateOptions, Options, UserName, Password

Parameters

Source
Optional. A Variant that may represent the URL of the entity to be represented by this Record object, a Command, an open Recordset or another Record object, a string containing a SQL SELECT statement or a table name.
ActiveConnection
Optional. A Variant that represents the connect string or open Connection object.
Mode
Optional. A ConnectModeEnum value, whose default value is adModeUnknown, that specifies the access mode for the resultant Record object.
CreateOptions
Optional. A RecordCreateOptionsEnum value, whose default value is adFailIfNotExists, that specifies whether an existing file or directory should be opened, or a new file or directory should be created. If set to the default value, the access mode is obtained from the Mode property. This parameter is ignored when the Source parameter doesnt contain a URL.
Options
Optional. A RecordOpenOptionsEnum value, whose default value is adOpenRecordUnspecified, that specifies options for opening the Record. These values may be combined.
UserName
Optional. A String value that contains the user ID that, if needed, authorizes access to Source.
Password
Optional. A String value that contains the password that, if needed, verifies UserName.

Remarks

Source may be:

  • A URL. If the protocol for the URL is http, then the Internet Provider will be invoked by default. If the URL points to a node that contains an executable script (such as an .ASP page), then a Record containing the source rather than the executed contents is opened by default. Use the Options argument to modify this behavior.
  • A Record object. A Record object opened from another Record will clone the original Record object.
  • A Command object. The opened Record object represents the single row returned by executing the Command. If the results contain more than a single row, the contents of the first row are placed in the record and an error may be added to the Errors collection.
  • A SQL SELECT statement. The opened Record object represents the single row returned by executing the contents of the string. If the results contain more than a single row, the contents of the first row are placed in the record and an error may be added to the Errors collection.
  • A table name.

If the Record object represents an entity that cannot be accessed with a URL (for example, a row of a Recordset derived from a database), then the values of both the ParentURL property and the field accessed with the adRecordURL constant are null.

Note   URLs using the http scheme will automatically invoke the Microsoft OLE DB Provider for Internet Publishing. For more information, see Absolute and Relative URLs.

See Also

Example | Example

Open Method (ADO Connection) | Open Method (ADO Recordset) | Open Method (ADO Stream) | OpenSchema Method

Applies To: Record Object

© 1998-2003 Microsoft Corporation. All rights reserved.