Connect VB 2008 to Microsoft Access 2007

October 2016

Programs written in Microsoft Visual Basic can access Microsoft Access 2007 databases. Some knowledge of programming concepts and databases may be required to connect a VB 2008 to Microsoft Access 2007. The database connectivity object ADODB provides the ADODB.Connection API to connect to the Microsoft Access 2007 databases. The database records can be accessed from the Visual Basic code using the ADODB.Recordset API. When creating a VB 2008 connection to Microsoft Access 2007 database, the provider should be input as "Microsoft.Jet.OLEDB.4.0" in the ConnectionString interface. The Open() interface will open the connection between the Visual Basic code and Microsoft Access 2007 database.


Can VB 2008 connect to Access 2007 or do I have to change the format of my database?

I tried to run my project without changing it but it said it couldn't find my database...


This coding works for me:

Dim Conn As New ADODB.Connection   
Dim Rec As New ADODB.Recordset   

Private Sub Form4_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load   
Conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= " & "dbase1.mdb"   

End Sub


Thanks to Tanya for this tip on the forum.

Related :

This document entitled « Connect VB 2008 to Microsoft Access 2007 » from CCM ( is made available under the Creative Commons license. You can copy, modify copies of this page, under the conditions stipulated by the license, as this note appears clearly.