MS Access connection from VB 6

Posted on 2010-01-05
Last Modified: 2012-05-08
Hi - I am a .NET developer working on a legacy app and I need to access MS Access from VB 6. I have found some samples on how to do this (E.g however the code fails on the first line:

Dim con As New ADODB.Connection

Compile Error: User -defined type not define

Do I need some kind of import?
Question by:jes12345
    LVL 17

    Accepted Solution


    Click Project Menu, Then References.

    Then add AcriveX Data Objects 2.8 or 2.7 or any version you have installed.
    LVL 29

    Assisted Solution

    If you haven't added a reference already try Project > Project References > Microsoft ActiveX Data Objects Library

    Author Comment

    Thanks for the advise. Worked like a charm. Is the
    "Microsoft ActiveX Data Objects Library" standard Windows library? I.e can I know for sure this will be installed on a XP,Vista or Win 7 target machine?
    LVL 29

    Assisted Solution

    You will need to install/register with the application.

    Author Closing Comment


    Featured Post

    Free Trending Threat Insights Every Day

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Join & Write a Comment

    Suggested Solutions

    Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
    Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
    Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
    This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now