Connect Method (ActiveX/CAO)

Connects to a data source.

Signature

VBA / VB.NET

object.Connect(Datasource [, Username] [, Password] [, Prompt])
object

Type: DbConnect

The object or objects this method applies to.

Datasource

Type: String; input-only

The name of a .udl file in the Data Links directory.

Username

Type: String; input-only; optional

User name with which you are connecting.

Password

Type: String; input-only; optional

Password for connecting.

Prompt

Type: Boolean; input-only; optional

Specifies whether users are prompted to specify connection properties.

  • TRUE: Prompts users to specify required connection properties, if some are missing.
  • FALSE: Does not prompt users to specify connection properties

Remarks

If the data source is already connected, nothing happens.