0
Thanks

A few words of thanks would be greatly appreciated.

Connect VB 2008 to Microsoft Access 2007

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.

Issue


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...

Solution


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"   
Conn.Open()   

End Sub

Note


Thanks to Tanya for this tip on the forum.
0
Thanks

A few words of thanks would be greatly appreciated.

Ask a question
CCM is a leading international tech website. Our content is written in collaboration with IT experts, under the direction of Jeff Pillou, founder of CCM.net. CCM reaches more than 50 million unique visitors per month and is available in 11 languages.

Published by . Latest update on by Virginia Parsons.

This document, titled "Connect VB 2008 to Microsoft Access 2007," is available under the Creative Commons license. Any copy, reuse, or modification of the content should be sufficiently credited to CCM (https://ccm.net/).

0 Comments