how do i connect access 2007 to vb6

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

thanks a lot for support me

No Problem..
You can mark this thread now as SOLVE.. Thanks..

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.