Pert.11 (Visual Basic)

Jangan lupa untuk koneksi database kita menggunakan database yang pertamakali kita buat, yaitu database pembelian.

Tampilan Disain :
vb03.jpg

Tampilan Setelah dijalankan :
vb01.jpg

vb02.jpg

Listing Program :
Jangan Lupa terlebih dahulu kamu buat prosedure aktif, nonaktif, bersih

Dim x As Control

Private Sub Cmdnew_Click()
Data1.Recordset.AddNew
Text1.MaxLength = 5 ——–> Menentukan panjang kode adalah 5
bersih
aktif
Text1.SetFocus
End Sub

Private Sub nonaktif()
For Each x In Me
If TypeName(x) = “TextBox” Then
x.Enabled = False
End If
Next
End Sub

Private Sub aktif()
For Each x In Me
If TypeName(x) = “TextBox” Then
x.Enabled = True
End If
Next
End Sub

Private Sub bersih()
For Each x In Me
If TypeName(x) = “TextBox” Then
x.Text = “”
End If
Next
End Sub

Private Sub Cmdcari_Click()
Dim mkode As String * 5
mkode = InputBox(“Masukan Kode Barang”, “Pencarian Data Barang”)
msyarat = “Kode = ‘” & mkode ‘”
Data1.Recordset.Index = “barangdex” –> pastikan data1 (properties) recordsettype 0-Table
Data1.Recordset.Seek “=”, mkode
If Data1.Recordset.NoMatch Then
MsgBox “Data Belum Ada”, vbOKOnly, “Informasi”
Data1.Recordset.MoveFirst
End If
End Sub

Private Sub Cmdsave_Click()
Data1.Recordset.Update
nonaktif
End Sub

Private Sub Cmdedit_Click()
Data1.Recordset.Edit
aktif
Data1.Recordset.Update
End Sub

Private Sub Cmddelete_Click()
Data1.Recordset.Delete
Data1.Recordset.MoveFirst
End Sub

Private Sub Cmdexit_Click()
Unload Me
End Sub

Private Sub Cmdprevious_Click()
Data1.Recordset.MovePrevious
If Data1.Recordset.BOF Then
MsgBox “Data sudah diawal record”, vbOKOnly, “info”
Data1.Recordset.Movefirst
End If
End Sub

Private Sub Cmdlast_Click()
Data1.Recordset.MoveLast
End Sub

Private Sub Cmdtop_Click()
Data1.Recordset.MoveFirst
End Sub

Private Sub Cmdnext_Click()
Data1.Recordset.MoveNext
If Data1.Recordset.EOF Then
MsgBox “Data sudah diakhir record”, vbOKOnly, “info”
Data1.Recordset.MoveLast
End If
End Sub

Private Sub Form_Load()
nonaktif
End Sub

Private Sub Timer1_Timer()
Me.BackColor = RGB(255 * Rnd, 255 * Rnd, 255 * Rnd)
End Sub


Coba dikembangkan lagiiiii……..

Iklan

7 Comments

  1. Pada Source

    Private Sub Cmdcari_Click()
    Dim mkode As String * 5
    mkode = InputBox(“Masukan Kode Barang”, “Pencarian Data Barang”)
    msyarat = “Kode = ‘” & mkode ‘”
    Data1.Recordset.Index = “barangdex” –> pastikan data1 (properties) recordsettype 0-Table
    Data1.Recordset.Seek “=”, mkode
    If Data1.Recordset.NoMatch Then
    MsgBox “Data Belum Ada”, vbOKOnly, “Informasi”
    Data1.Recordset.MoveFirst
    End If
    End Sub

    m (mkode) itu nyangkut nya kmna..??

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s