Dari judul mungkin udah terang postingan ini ihwal apa, jadi pribadi aja yaaah... Dua tabel dari database yang mau kita gunakan yakni: Tabel Kategori: Tabel Item: Atur UI di form selaku berikut: Seperti biasa kita perlu mengimport OLEDB untuk menciptakan koneksi Access, di bab paling atas jendela code. Imports System.Data.OleDb Kemudian di antara area class form kita deklarasikan object koneksi dan buat suatu sub procedure untuk mebuka koneksi. Dim con As New OleDbConnection Sub Open_Koneksi() con.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0" & _ ";Data Source=latihan.accdb;" & _ "Persist Security Info=False;" con.Open() End Sub Kode untuk memperlihatkan data di ComboBox1 Sub ListKategori() Dim cmd As New OleDbCommand Dim adapt As New OleDbDataAdapter Dim dt As New DataTable Try If Not con.State = ConnectionState.Open Then Open_Koneksi() cmd.Connection = con cmd.CommandText = "Select kodekategori, namakategori From kategori" adapt.SelectCommand = cmd adapt.Fill(dt) ComboBox1.DataSource = dt ComboBox1.DisplayMember = "namakategori" ComboBox1.ValueMember = "kodekategori" con.Close() Catch myerror As OleDbException MessageBox.Show( "Error: " & myerror.Message) Finally con.Dispose() End Try End Sub Runtime: Kode selengkapnya: Imports System.Data.OleDb Public Class Form2 Dim con As New OleDbConnection Sub Open_Koneksi() con.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0" & _ ";Data Source=latihan.accdb;" & _ "Persist Security Info=False;" con.Open() End Sub Sub ListKategori() Dim cmd As New OleDbCommand Dim adapt As New OleDbDataAdapter Dim dt As New DataTable Try If Not con.State = ConnectionState.Open Then Open_Koneksi() cmd.Connection = con cmd.CommandText = "Select kodekategori, namakategori From kategori" adapt.SelectCommand = cmd adapt.Fill(dt) ComboBox1.DataSource = dt ComboBox1.DisplayMember = "namakategori" ComboBox1.ValueMember = "kodekategori" con.Close() Catch myerror As OleDbException MessageBox.Show( "Error: " & myerror.Message) Finally con.Dispose() End Try End Sub Sub DisplayToGrid( ByVal KodeKategori As String ) Dim cmd As New OleDbCommand Dim adapt As New OleDbDataAdapter Dim dt As New DataTable Try If Not con.State = ConnectionState.Open Then Open_Koneksi() cmd.Connection = con cmd.CommandText = "SELECT kodeitem, namaitem FROM item " & _ "WHERE kodekategori = '" & KodeKategori & "'" adapt.SelectCommand = cmd adapt.Fill(dt) DataGridView1.DataSource = dt Catch ex As OleDbException MessageBox.Show( "Error: " & ex.Message) Finally con.Close() End Try End Sub Private Sub Form2_Load(sender As Object, _ e As EventArgs) Handles MyBase .Load ComboBox1.DropDownStyle = ComboBoxStyle.DropDownLis ListKategori() End Sub Private Sub ComboBox1_SelectedValueChanged(sender As Object, _ e As EventArgs) Handles ComboBox1.SelectedValueChanged DisplayToGrid (ComboBox1.SelectedValue.ToString) End Sub End Class Click here if you like this article. Sumber http://rani-irsan.blogspot.com