VB6 Connection to Microsoft Access 2000

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.

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

There are many reasons for this error.

These links will help you:


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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

>>Alternatively, you can use the ADO control

Don't,  you will be sorry.

JimKerryAuthor Commented:
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.