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.
Connect VB 2008 to Microsoft Access 2007
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.
See also
Knowledge communities.
Published by
aakai1056 -
Latest update by Virginia Parsons