Form Buku - Sistem Informasi Penjualan (VB6)

Pada postingan kedua mengenai sistem informasi penjualan kita akan membuat form Buku. Terlebih dahulu silahkan design form buku tersebut seperti gambar di diatas.

Untuk Command Button, kesemua command button di beri nama cmdNav


Berikut  Form Buku - Sistem Informasi Penjualan (VB6).

Private Sub CmdNav_Click(Index As Integer)
Select Case Index
    Case 0
        RUBAH False, True, False, False, True, True
        Call Hapus
        txtKD.SetFocus
    Case 1
        RUBAH True, False, False, False, False, True
        SimpanData True
    Case 2
        RUBAH True, False, False, False, False, True
        SimpanData False
    Case 3
        With Data1.Recordset
            If .RecordCount = 0 Then Exit Sub
            .Delete
            .MoveFirst
        End With
        Call Hapus
    Case 4
        RUBAH True, False, False, False, False, True
        Call Hapus
    Case 5
        Unload Me
End Select
End Sub

Private Sub Form_Activate()
    RUBAH True, False, False, False, False, True
End Sub
Private Sub txtKd_KeyPress(KeyAscii As Integer)    KeyAscii = Asc(UCase(Chr(KeyAscii)))
    If KeyAscii = 13 Then
        If txtKD.Text = "" Then
            txtKD.SetFocus
        Else
            With Data1.Recordset
                .Index = "KdBarang"
                .Seek "=", txtKD.Text
                If .NoMatch Then
                    x = txtKD.Text
                    Hapus
                    txtKD.Text = x
                    RUBAH False, True, False, False, True, True
                Else
                    RUBAH False, False, True, True, True, True
                    Call Tampil
                End If
                txtNama.SetFocus
            End With
        End If
    End If
End Sub

Sub SimpanData(Log As Boolean)
    'On Error Resume Next
    With Data1.Recordset
        If Log Then .AddNew Else .edit
        !KdBarang = txtKD.Text
        !Nama = txtNama.Text
        !pengarang = txtPengarang.Text
        !Penerbit = txtPenerbit.Text
        !harga = txtHarga.Text
        !Stock = txtStock.Text
        .Update
    End With
    Data1.Refresh
    Call Hapus
End Sub

Sub Tampil()
    On Error Resume Next
    With Data1.Recordset
        txtNama.Text = !Nama
        txtHarga.Text = !harga
        txtPengarang.Text = !pengarang
        txtPenerbit.Text = !Penerbit
        txtStock.Text = !Stock
    End With
End Sub

Sub Hapus()
    txtKD.Text = ""
    txtNama.Text = ""
    txtHarga.Text = ""
    txtPengarang.Text = ""
    txtPenerbit.Text = ""
    txtStock.Text = ""
End Sub

Sub RUBAH(L0 As Boolean, L1 As Boolean, L2 As Boolean, L3 As Boolean, L4 As Boolean, L5 As Boolean)
    CmdNav(0).Enabled = L0
    CmdNav(1).Enabled = L1
    CmdNav(2).Enabled = L2
    CmdNav(3).Enabled = L3
    CmdNav(4).Enabled = L4
    CmdNav(5).Enabled = L5
End Sub
Demikianlah program Form Buku - Sistem Informasi Penjualan (VB6)

Belum ada komentar untuk "Form Buku - Sistem Informasi Penjualan (VB6)"

Post a Comment

Terima kasih sudah memberikan komentar anda dengan baik.Konversi KodeEmoticonFolllow

Back to Top