Connecting to Microsoft Access with ADO - Create a UDL file to connect to an MDB file
(Page 3 of 6 )
For ODBC you straight away click on the Control Panel to access ODBC Data Sources in the Administrative tools. However, for ADO you adopt a different procedure. You create what is called a "UDL" file. You need this because it provides you with the mantra to connect to a database, called the connection string, the single most important thing for connectivity.
It's very easy to create a UDL file. Create an empty text file and save it with some (any) name but save it with the extension UDL. I created a text file adotest.txt and renamed it adotest.udl. Windows may warn you that it may not be usable but you may ignore the warning. When you place your mouse over it, the tool tip tells you it is a Microsoft Data Link file. Right click the file and click on properties; this pops up the window shown in the following picture. It opens with the General tab in view as seen here.

Click on the Provider tab, one of the important parts of the connection string. This opens up the tabbed window as shown in the next picture. You can see a whole lot of providers, and there are drivers written by many companies that you may not see here. Highlight the Microsoft Jet 4.0 OLE DB Provider and move over to the next tab.

This brings you to the Connection tab, where you indicate the source of your Jet database. In this case you browse to the location of the mdb file on your machine, perhaps C:/My Documents folder. In my case it is in the samples folder of Office 11 / MS Access 2003. The default permissions are set for Admin as User Name and a blank for the password.
Now you may test the connection as shown here. The Advanced tab is to configure the access permissions. It is set to share deny none as default, and the All tab lists the details and initialization chosen for this kind of source. It is possible to edit information in this window. The defaults were accepted for this tutorial. This completes the process of creating the UDL file.

Next: Read the connection string from the file >>
More Microsoft Access Articles
More By Jayaram Krishnaswamy