TableDef.Connect property (DAO)
Applies to: Access 2013, Office 2013
Sets or returns a value that provides information about a linked table. Read/write String.
Syntax
expression .Connect
expression A variable that represents a TableDef object.
Remarks
The Connect property setting is a String composed of a database type specifier and zero or more parameters separated by semicolons. The Connect property passes additional information to ODBC and certain ISAM drivers as needed.
For a TableDef object that represents a linked table, the Connect property setting consists of one or two parts (a database type specifier and a path to the database), each of which ends with a semicolon.
The path as shown in the following table is the full path for the directory containing the database files and must be preceded by the identifier DATABASE=. In some cases (as with Microsoft Excel and Microsoft Access database engine databases), you should include a specific file name in the database path argument.
The following table shows possible database types and their corresponding database specifiers and paths for the Connect property setting.
Database type |
Specifier |
Example |
---|---|---|
Microsoft Access Database |
[database]; |
drive:\path\filename |
dBASE III |
dBASE III; |
drive:\path |
dBASE IV |
dBASE IV; |
drive:\path |
dBASE 5 |
dBASE 5.0; |
drive:\path |
Paradox 3.x |
Paradox 3.x; |
drive:\path |
Paradox 4.x |
Paradox 4.x; |
drive:\path |
Paradox 5.x |
Paradox 5.x; |
drive:\path |
Microsoft Excel 3.0 |
Excel 3.0; |
drive:\path\filename.xls |
Microsoft Excel 4.0 |
Excel 4.0; |
drive:\path\filename.xls |
Microsoft Excel 5.0 or Microsoft Excel 95 |
Excel 5.0; |
drive:\path\filename.xls |
Microsoft Excel 97 |
Excel 8.0; |
drive:\path\filename.xls |
Lotus 1-2-3 WKS and WK1 |
Lotus WK1; |
drive:\path\filename.wk1 |
Lotus 1-2-3 WK3 |
Lotus WK3; |
drive:\path\filename.wk3 |
Lotus 1-2-3 WK4 |
Lotus WK4; |
drive:\path\filename.wk4 |
HTML Import |
HTML Import; |
drive:\path\filename |
HTML Export |
HTML Export; |
drive:\path |
Text |
Text; |
drive:\path |
ODBC |
ODBC; DATABASE=database; UID=user; PWD=password; DSN= datasourcename; [LOGINTIMEOUT=seconds;] |
None |
Microsoft Exchange |
Exchange 4.0; MAPILEVEL=folderpath; [TABLETYPE={ 0 | 1 }];[PROFILE=profile;] [PWD=password;] [DATABASE=database;] |
drive:\path\filename |
If a password is required but not provided in the Connect property setting, a login dialog box is displayed the first time a table is accessed by the ODBC driver and again if the connection is closed and reopened.
For data in Microsoft Exchange, the required MAPILEVEL key should be set to a fully-resolved folder path (for example, "Mailbox - Pat SmithIAlpha/Today"). The path does not include the name of the folder that will be opened as a table; that folder’s name should instead be specified as the name argument to the CreateTable method. The TABLETYPE key should be set to "0" to open a folder (default) or "1" to open an address book. The PROFILE key defaults to the profile currently in use.
For base tables in a Micorosoft Access database, the Connect property setting is a zero-length string ("").
Note
- You must set the Connect property before you set the ReturnsRecords property.
- You must have access permissions to the computer that contains the database server you're trying to access.