DAO 3.6 Library

Getting Started

Right, first things first... to be able to use MS Access 2000, Visual Basic needs a way to communicate with it. This can be done in many ways, but as some of you may have guessed by looking at the title of this article, I'll be using DAO 3.6.

So for our code to work, we first need to start VB and add a reference to the DAO 3.6 Library. To do this, click Project and then References and browse for the library. It should be called "Microsoft DAO 3.6 Object Library" or similar. Check it and click Ok.

So what has this done? Basically, we can now define new types of variable, such as a database object. This allows Visual Basic to understand and manipulate the complex structures that Access uses to store our data.

At this point, it may be worth noting some things I always adhere to when using Access - first of all, whenever I make a table in Access, I always create a field which is used as a unique identifer for that record and I always call this field ID. This is usually known as the primary key. A lot of people select Access' special Autonumber field type for this field. Personally, I like to be in control of this field so I set it to a pure Number field type. All of my tables start with record number 1. This way I can count the number of records more easily. This may not suit some people, so you may need to alter the following code.

Everybody has their personal preferences, so set out your database however suits you. Just make sure you're consistent!

You might also like...



Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Any fool can write code that a computer can understand. Good programmers write code that humans can understand.” - Martin Fowler