VB6 Connection to Microsoft Access 2000

Posted on 2004-11-11
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 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

    There are many reasons for this error.

    These links will help you:
    LVL 5

    Assisted Solution

    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

    >>Alternatively, you can use the ADO control

    Don't,  you will be sorry.


    Author Comment

    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

    Enabling OSINT in Activity Based Intelligence

    Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

    Join & Write a Comment

    Introduction In a recent article ( for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
    Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
    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…
    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…

    733 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

    20 Experts available now in Live!

    Get 1:1 Help Now