0% found this document useful (0 votes)
73 views

Modul 01

The document discusses steps to connect to a database and create a form for inputting purchase data in Microsoft Access. It includes: 1) Creating a PENJUALAN database in Access and a PEMBELIAN table with fields for product code, name, type, unit, and price. 2) Designing an input form in Visual Basic with labels, textboxes, and combo boxes bound to the table using an ADO data control and datagrid. 3) Writing code to add new records to the table from the form, clear the form fields, and set focus between controls as the user tabs through the form.

Uploaded by

api-3766684
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
73 views

Modul 01

The document discusses steps to connect to a database and create a form for inputting purchase data in Microsoft Access. It includes: 1) Creating a PENJUALAN database in Access and a PEMBELIAN table with fields for product code, name, type, unit, and price. 2) Designing an input form in Visual Basic with labels, textboxes, and combo boxes bound to the table using an ADO data control and datagrid. 3) Writing code to add new records to the table from the form, clear the form fields, and set focus between controls as the user tabs through the form.

Uploaded by

api-3766684
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 4

Modul 1

Koneksi Ke Database dengan ADODC

Langakah 1 : Buat database dengan nama PENJUALAN dengan Ms. Acces,

Start-Program-Ms.Acess-Blank Database
Langkah 2 : Buat Tabel PEMBELIAN dengan field sebagai berikut:
Field Type Width Ket
Kode Barang Text 9 Primary Key
Nama Barang Text 50
Jenis Barang Text 25
Satuan Text 5
Harga Beli Number Long Integer

Create Table In Design View

Langkah 3 : Buat Form Input di Ms. Visual Basic


Properti Setting Ket
Label 1 Input Pembelian
Label 2 Kode Barang
Label 3 Nama Barang
Label 4 Jenis Barang
Label 5 Satuan
Label 6 Harga
Text 1 Txtkd_brg
Text 2 Txtnm_brg
Combo1 Cmb_brg
Combo2 Cmb_stn
Text3 Txthg_brg
Adodc1 Adodc1
Command1 &Simpan
Command2 &Koreksi
Command3 &Hapus
Command4 &Update
DataGrid1 Datagrid1 Data Source: Adodc1

Adodc1 dan DataGrid1 ditambahkan dari Project-Component- Microsoft ADO


Data Control 6.0 (OLEDB)  Microsoft DataGrid Control 6.0 (OLEDB)

Source Code:

Private Sub cmb_brg_KeyPress(KeyAscii As Integer)


If KeyAscii = 13 Then
cmb_stn.SetFocus
End If

End Sub
Private Sub cmb_stn_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
txthg_brg.SetFocus
End If

End Sub

Private Sub cmd_smpn_Click()


With Adodc1.Recordset
.AddNew
!Kode_Barang = txtkd_brg.Text
!Nama_Barang = txtnm_brg.Text
!Jenis_Barang = cmb_brg.Text
!Satuan = cmb_stn.Text
!Harga = txthg_brg.Text
.Update
End With
kosong
End Sub
Private Sub kosong()
txtkd_brg.Text = ""
txtnm_brg.Text = ""
cmb_brg.Text = ""
cmb_stn.Text = ""
txthg_brg.Text = ""
End Sub

Private Sub txthg_brg_KeyPress(KeyAscii As Integer)


If KeyAscii = 13 Then
cmd_smpn.SetFocus
End If

End Sub

Private Sub txtkd_brg_KeyPress(KeyAscii As Integer)


If KeyAscii = 13 Then
txtnm_brg.SetFocus
End If
End Sub

Private Sub txtnm_brg_KeyPress(KeyAscii As Integer)


If KeyAscii = 13 Then
cmb_brg.SetFocus
End If
End Sub

You might also like