Microsoft Access
  Home arrow Microsoft Access arrow Page 4 - Connecting to Microsoft Access with ADO
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
ASP Web Hosting  
ASP.NET Web Hosting 
Mobile Linux 
App Generation ROI 
Windows Web Hosting
 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
MICROSOFT ACCESS

Connecting to Microsoft Access with ADO
By: Jayaram Krishnaswamy
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 18
    2006-04-19

    Table of Contents:
  • Connecting to Microsoft Access with ADO
  • Overview of ActiveX Data Objects
  • Create a UDL file to connect to an MDB file
  • Read the connection string from the file
  • Create a reference to ADO
  • Write code to open and close the ADODB connection to the database

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Connecting to Microsoft Access with ADO - Read the connection string from the file


    (Page 4 of 6 )

    In reality the UDL file that was created is a text file. Right click and opt to open with a text editor. For the adotest.udl file, I have the following information, shown in the next paragraph. It's really very simple, especially when the authentication information is set for the Admin.

    [oledb]
    ; Everything after this line is an OLE DB initstring
    Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Program Files\
    Microsoft Office\OFFICE11\SAMPLES\Northwind.mdb;
    Persist Security Info=False
    Create an MDB file, create a new form and add module

    Just open your MS Access application and choose to Create a New File... which prompts you for a number of options. Choose to create a blank database. For this tutorial, I created an AdoTest.mdb file. I added a form and button with the caption Open/Close a database, as shown in the next picture. Since I do not need navigation and other related items, I chose not to show them by choosing property values for the items in the form's properties page.  Instead of the Command button's click event, you may also use other events of other controls or even a Module.

    Open the form in design view by first highlighting Form1 and then choosing Design View. Right click on the Command button, click on Build Event... and in the Choose Builder pop-up that comes up, click on Code Builder.

    You will get to the screen shown next. If you want to go back to the form just click on the MS Access icon on the tool bar. In addition to Form1, I also have a Form2, which is not used in this tutorial. The code page for Form1 is called AdoTest - Form_Form1(code).  This is where the code for the form and for any controls on the form are written. Presently there is no code except an empty click event for the Command0 button.

    More Microsoft Access Articles
    More By Jayaram Krishnaswamy


       · Yes, that is true coming straight from the vaults of MS. These remain for backward...
       · i'm new person want to use the aplication asp. Can u give me the sample how to...
       · I have created a system DSN called 'ForAsp' for your illustrationI have an IIS...
       · Send me your email, I will send the code.Jay
     

    MICROSOFT ACCESS ARTICLES

    - Linking SQL Express 2005 Tables to MS Access...
    - Working with Access Projects in Access 2007
    - Exploring Access 2007
    - Working with Stored Procedures in an MS Acce...
    - Creating and Using Action Queries
    - Creating Data Access Pages with Charts using...
    - Advanced Ideas using VBA
    - VBA Details
    - Updating Records in MS Access
    - Using ADO`s Record Object with URLs
    - Exporting XML from MS Access 2003
    - Importing XML into MS Access 2003
    - On Using Pass-through Queries in MS Access
    - Distributed Queries in MS Access
    - Configuring a Linked Microsoft Access Server...





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
    Stay green...Green IT