MS Access connection from VB 6

Posted on 2010-01-05
Medium Priority
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 http://bytes.com/topic/visual-basic/answers/569821-how-do-i-connect-vb-6-0-form-access-database) 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
  • 2
  • 2
LVL 17

Accepted Solution

CSecurity earned 668 total points
ID: 26180102

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

nffvrxqgrcfqvvc earned 1332 total points
ID: 26180109
If you haven't added a reference already try Project > Project References > Microsoft ActiveX Data Objects Library

Author Comment

ID: 26180782
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

nffvrxqgrcfqvvc earned 1332 total points
ID: 26180819
You will need to install/register with the application.

Author Closing Comment

ID: 31672887

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Hello there! As a developer I have modified and refactored the unit tests which was written by fellow developers in the past. On the course, I have gone through various misconceptions and technical challenges when it comes to implementation. I would…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…
Suggested Courses

621 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