VB6 to Access 2000 Database Link - TechRepublic
General discussion
July 5, 2001 at 05:19 AM
donq

VB6 to Access 2000 Database Link

by donq . Updated 24 years, 11 months ago

I have a working Access 2000 application I want to convert into an executable using VB6.0. My Operating System is Windows 2000 and my VB comes from Visual Studio 6 w/SP-3 installed. I want Version 1.1 of my project named ?BNM? to link to an Accessback-end employing Microsoft?s DAO 3.51 Object Library. I don?t want to build this executable with the Access Developers Toolkit ? I need to learn pure VB and want to it managing objects I understand.

I am having trouble declaring and loading the link to BNM.mdb (my Microsoft Access 2000 application containing the tables, queries, forms, reports, and modules) into my VB Project named BNM. I have created a ?BNM? directory on my C:\ drive where I store BNM.mdb (C:\DataByte\BNM\BNM.mdb) and the Visual Basic Project (C:\DataByte\BNM\BNM.vbp).

I installed the Microsoft DAO 3.51 Object Library (via Project | References) and renamed Form1 to ?frmDesktop?. My new VB Project hierarchy reads ?BNM(BNM.vbp)? and it has a Forms collection containing ?frmDesktop(Desktop.frm)?.

Where do I declare and place the code:

Dim db As Database

Set db = OpenDatabase(?C:\DataByte\BNM\BNM.mdb?)

I need one or more of my 12-15 tables available to every object I create within the BNM Visual Basic 6 project so I can write unique recordsets to each form?s load event?

When I place this code in my only Form?s Load Event I get a Run-ime Error ?3343.?: Unrecognized database format ?C:\DataByte\BNM\BNM.mdb?.?

What ?library? must I loadin order to connect to an Access 2000 .mdb file, and where and how should I call my link from within the (Visual Basic) BNM project? Can I also import and convert existing Access Forms so I don?t have to start from scratch defining my interface once I have a working connection?

Thanks in advance. Don Quigg

This discussion is locked

All Comments