Navigation:  DAO Object Classes > DaoDatabase Class >

DaoDatabase:Connect Access/Assign

Previous pageReturn to chapter overviewNext page


A string value that Sets or returns a value providing information about a data source.







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 Jet 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. You can also specify "FTP://path/etc." or "HTTP://path/etc." For the path. In an ODBCDirect workspace, only the "ODBC" specifier can be used.


Database type        Specifier        Example        


Microsoft Jet Database        [database];        drive:\path\filename.mdb        

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        

FoxPro 2.0        FoxPro 2.0;        drive:\path        

FoxPro 2.5        FoxPro 2.5;        drive:\path        

FoxPro 2.6        FoxPro 2.6;        drive:\path        

Excel 3.0        Excel 3.0;        drive:\path\filename.xls        

Excel 4.0        Excel 4.0;        drive:\path\filename.xls        

Excel 5.0 or Excel 95        Excel 5.0;        drive:\path\filename.xls        

Excel 97        Excel 97;        drive:\path\filename.xls        

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        

Exchange        Exchange;  MAPILEVEL=folderpath; [TABLETYPE={ 0 | 1 }];[PROFILE=profile;] [PWD=password;] [DATABASE=database;]        drive:\path\filename.mdb        


If the specifier is only "ODBC;", the ODBC driver displays a dialog box listing all registered ODBC data source names so that the user can select a database.

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 Microsoft Jet database (.mdb), the Connect property setting is a zero-length string ("").


You can set the Connect property for a Database object by providing a source argument to the OpenDatabase method. You can check the setting to determine the type, path, user ID, password, or ODBC data source of the database.




Exchange sample

Link sample