Microsoft Office 2000/Visual Basic Programmer's Guide   

Connecting to a Database by Using a Data Link File

You can also save OLE DB connection information to a data link file and use that file to open a data source. A data link file is similar to a File DSN (data source name) that is created by using the ODBC Data Source Administrator, except that a data link defines OLE DB connection information, instead of ODBC connection information. To create a data link file, right-click in a folder, and then click Microsoft Data Link on the New submenu. Double-click the file to display the Data Link Properties dialog box, click the Provider tab, and then select Microsoft Jet 4.0 OLE DB Provider. Click the Connection tab to define basic connection information, and use the Advanced or All tab if you want to define additional settings.

To use the Open method of the Connection object to a database by using a data link file, pass the location of the data link file in the File Name property to the ConnectionString argument as shown in the following line of code:

cnnDB.Open "File Name=C:\DataLinks\MyDataLink.udl"