VB 6.0 - How to connect Access 2003 Database ( .mdb )

In this tutorial, we'll share about How to connect Access 2003 Database ( .mdb ).

Create database : DBTM.mdb
Create Tabke : TBL_USERS
Design TBL_USERS like below picture


Create Folder with name : VB6 Access 2003
Fill your database ( DBTM.mdb ) to folder above

Open your VB 6.0 application
Create Form1 like below picture
Place code below to Form1

Dim Conn As New ADODB.Connection
Dim RSUsers As ADODB.Recordset
Sub OpenDB()
Set Conn = New ADODB.Connection
Set RSUsers = New ADODB.Recordset
Conn.Open "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\DBTM.mdb"
End Sub
Private Sub Form_Load()
Call OpenDB
Adodc1.ConnectionString = Conn
Adodc1.RecordSource = "TBL_USERS"
Adodc1.Refresh
Set DataGrid1.DataSource = Adodc1
End Sub
 Save your project to folder VB6 Access 2003
and the last, you can run your project
Below for the result

  Click Here to download project above

0 Response to "VB 6.0 - How to connect Access 2003 Database ( .mdb )"