Here you can use this connection..

Public cn as New ADODB.Connection

Public Sub Con(DBPath as String, optional DBPass as string)

cn.Open "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & DBPath & ";Jet OLEDB:Database Password=" & DBPass & ";"

end Sub

hello,
i was ask to document how to connect vb6 and access2007. what are the steps on connecting vb6 and access 2007 and can anyone give an example of its codes?
please help me.

hello,
i was ask to document how to connect vb6 and access2007. what are the steps on connecting vb6 and access 2007 and can anyone give an example of its codes?
please help me.

How...

You must already created your database on you access 2007.
Open your VB6 Project
Goto Project > References
Tick - Microsoft ActiveX Data Objects 2.0
Click Ok

After that, Create a Module and add this Code...

Public cn as New ADODB.Connection

Public Sub Con(DBPath as String, optional DBPass as string)

cn.Open "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & DBPath & ";Jet OLEDB:Database Password=" & DBPass & ";"

end Sub

DBPath - Location of your access 2007 database and its filename
DBPass - password of your database if you have put password on it.

That sub will just open a connection to your database..

I hope you anderstand it and I hope this will help you..
If you want more, just search it on yahoo or google..

This article has been dead for over six months. Start a new discussion instead.