[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


VB6 Connection to Microsoft Access 2000

Posted on 2004-11-11
Medium Priority
Last Modified: 2013-12-25
Can anyone help me?


I've read some of the answers to questions posted about this subject but can't find anything specific to this error message without becoming a 'paid again member'!

I'm exploring VB6 with the hope of creating an application that can connect to an Access 2000 database and hopefully eventually being able to go on from this to allow access to the database on the internet. I assume I should be using VB.net but haven't been able to afford that luxury yet so am still using VB6.

When I try to make the connection I get an "unrecognized database format" message.

Having created a DAO DataLink with the VB6 wizard I can 'see' the database. In the DataView window I can see the tables and field names but when I try to set the RecordSource property of the DataLink I just get the error message.

This problem only seems to occur with later versions of Access i.e. 2000/ 2002. I have succesfully connected to an Access 97 version of the same database.

I have downloaded and run 'acc2conv' from Microsoft and 'compacted and repaired' the database but neither of these actions has solved the problem.

Question by:JimKerry
LVL 18

Accepted Solution

Sethi earned 300 total points
ID: 12561234
There are many reasons for this error.

These links will help you:


Assisted Solution

Pi7 earned 120 total points
ID: 12563468
with Access 2000 use the ADO instead of DAO.
To use the ADO:

1.   Add a reference-
       Click the Project Menu
       Click "References..."
       In the window the opens look for and check "Microsoft ActiveX Data Objects 2.x Library" (where x represents the latest version that you have)
       Click "OK" to close the window

2. Create an ADO object and open the connection

   Now Open code module
   In General section make these declarations:

   Dim rs as New ADODB.Recordset
   Dim cn as New ADODB.Connection

   Now in the appropriate event module(say Form_Load() ) type this
   'This opens the connection to the database Mydatabase
   With cn
        .ConnectionString ="Provider=Microsoft.Jet.OLEDB.4.0; Data Source =C:\MyDatabase.mdb"
   End With
  'You can open a recordset too
  rs.Open "Select * FROM Table1",cn,adOpenDynamic,adLockOptimistic,adcmdText
  'the above code opens a recordset which contains all records in a table,Table1, in the database


Alternatively, you can use the ADO control

LVL 29

Assisted Solution

leonstryker earned 80 total points
ID: 12567052
>>Alternatively, you can use the ADO control

Don't,  you will be sorry.


Author Comment

ID: 12575330
I'd been working my way through VB6 Database Programming some time ago and suddenly found a new reason to revisit it. I think I'd used the ADO connection before. I'd only got as far as using the wizards so haven't yet tried the 'proper way' as you've described it above. I've just opened a saved project and used the ADODC 'scroll bar' connection and as you've described it does work.

But why can't I connect with DAO. I can to an earlier version of Access. It just seems another hurdle only having recently (over the last few years) managing to refamiliarise myself to Basic working through a couple of terms of evening classes studying visual basic having to get my head around the ADO palaver. In my ignorance I didn't know it even existed until after I had completed the courses. What now they are trying to complicate things even further!! NJow I have to get my head around all the VBA code I've written since the visual basic courses having to try to figure out whether I have to re-write it to use the ADO technology.

Such is life I presume!!

Jim Kerry

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses

834 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