http://www.carlprothman.net/Default.aspx?tabid=90#ODBCDriverForAccessoConn.Open "Driver={Microsoft Access Driver (*.mdb)};" & _
"Dbq=c:\somepath\mydb.mdb;
"
Or
http://www.eggheadcafe.com/community/aspnet/14/63462/how-to-connect-vb-with-ms.aspxDim MyDatabase As OleDb.OleDbConnection
Dim ConnectToMyDatabase As String = "Provider=Microsoft.Jet.OL
EDB.4.0;" & _
"Data Source=
"
MyDatabase = New OleDb.OleDbConnection(ConnectToMyDatabase)
MyDatabase.Open()
http://www.kdkeys.net/forums/thread/868.aspx
To connect vb6.0 and MS access, I will make an example of connecting them using ADODB.
Dim sConn as string 'for the connection string
'now we declare the ADODB connection
'to be able to show this NEW ADODB.Connection line, you must do the following:
1. in the toolbox, you must add a component.
2. in the component box, find the Microsoft ActiveX ADO connection something like that.
3. then when this is done, drag the component into your form and then delete it
4. this way you may be able to have the NEW ADODB line in your intellisense
now lets proceed to connecting you db and vb6.0
Dim db as New ADODB.Connection
dim rs as new ADODB.Recordset
dim sPath as string ' here we put the path of your database
dim sSQL as string 'your SQL Statement
'like for example your vb application is on C:\MyVB
' and within that your DB is under another folder called DB
' we must get the path C:\MyVB\DB\yourdbname.mdb
' we shall be using app.path for getting the path of your application that is the C:\MyVB
' then we must concatenate the folder and the name of your database.
sPath = app.path & "\DB\yourdbname.mdb;"
'initialize the connection string
sConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & sPath
sSQL = "SELECT * FROM yourtablename"
...
;-)
JeffCoachman