# VB6 Data Control + Access 2000



## B3gbie (Nov 30, 2001)

Trying to link a vb6 data control to an access 2000 database using following code

Dim SQL As String

SQL = "Select * from " & TTDay
datTT.DatabaseName = "Timetable"
datTT.RecordSource = SQL
datTT.Refresh

The program works until refreshing the control and claims it cant find the database- any ideas why not?
I've tried using all the DAO references and no joy.


----------



## TimCottee (Oct 10, 2001)

Do you have Service Pack 4 for VB, if you don't then it won't work. The intrinsic data control from earlier releases is not compatible with access 2000, if you do have the SP4 version then you must make sure that you set the database type to access 2000; and not access;


----------



## Guest (Dec 10, 2001)

try and use the microsoft DAO 3.5 object library or higher
then the code will be:

With Data1
.Connect = "Access 2000;"
.DatabaseName = "C:\Program Files\Microsoft Visual Studio\VB98\Nwind.mdb"
.RecordSource = "Customers"
End With


----------



## TimCottee (Oct 10, 2001)

ren, that should be DAO 3.6 library, anything lower does * NOT * support access 2000.


----------



## Guest (Dec 11, 2001)

i didnt realize it was only 3.6
sorry for the mis-information
stick to ADO most of the time, suits me fine for both sql7 and access


----------



## TimCottee (Oct 10, 2001)

I agree, personally I use ADO exclusively except when trying to solve problems for others that are using DAO. There is as far as I am aware only the one thing that you cannot do in ADO and have to use DAO for, this is to set a database password in code. Everything else can be done in ADO and this makes it much easier to scale an application from a prototype in access to SQL server or other larger scale back-end.


----------



## B3gbie (Nov 30, 2001)

Thanks, got the service pack and no problems. As a relative beginner to VB programming I have not yet played with any ActiveX stuff (nor would i know how to). Anyway, DAO seems to work now (got SP5) on V3.6.

Cheers.


----------



## TimCottee (Oct 10, 2001)

Great,

DAO is fine in many ways, especially if you are using Access databases. However it will be worth your while looking at ADO for the future. The chances are that there will be little more development of DAO and ultimately little support for it. By contrast ADO is obviously Microsoft's focus at the moment and I can see that this will be the mechanism of choice going forward. Any experience that you have with DAO will not be totally wasted as many of the methods are similar if not the same. You also have the advantage of using exactly the same syntax and mechanisms against a much wider range of databases which allows you to easily scale applications from a simple access database to a full SQL server implementation or run the identical application on different backends by simply changing the connection string of the connection object.


----------

