Pert.Database(Form Supplier)

Buat Tampilan Sebagai berikut :
Tampilan Data Supplier :
vb011.jpg
Tampilan Browse Data Supplier :
vb021.jpg

Listing Program :
Sebelumnya Anda buat terlebih dahulu procedure aktif, nonaktif, bersih, dan tampil.

Dim x As Control
Private Sub tampil()
With Datasup.Recordset
If .RecordCount 0 Then
txtKoSup.Text = !kosup —> Field harus sesuai dengan field yang ada di tabel supplier
txtNaSup.Text = !nasup
txtAlamat.Text = !alamat
txtTelp.Text = !telpsup
txtCP.Text = !cpsup
End If
End With
End Sub

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

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

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

Private Sub cmdCari_Click()
Datasup.Recordset.FindFirst “nasup= ‘ ” & Trim(txtCari.Text) & ” ‘ ”
If Not Datasup.Recordset.NoMatch Then —-> Jika Datanya Ada
tampil
Else
MsgBox “Data TIDAK ADA”, vbOKOnly, “Informasi”
txtCari.Text = “”
txtCari.SetFocus
End If
End Sub

Private Sub cmdEdit_Click()
Datasup.Recordset.Edit
aktif
End Sub

Private Sub cmdHapus_Click()
P = MsgBox(“Yakin Mau Di Hapus ?”, vbYesNo + vbQuestion, “Hapus Record”)
If P = vbYes Then
Datasup.Recordset.Delete
Datasup.Recordset.MoveFirst
End If
End Sub

Private Sub cmdKeluar_Click()
K = MsgBox(“Anda Ingin Keluar ?”, vbYesNo + vbInformation, “Konfirmasi”)
If K = vbYes Then
Unload Me
End If
End Sub

Private Sub cmdSimpan_Click()
With Datasup.Recordset
.AddNew
!kosup = txtKoSup.Text
!nasup = txtNaSup.Text
!alamat = txtAlamat.Text
!telpsup = txtTelp.Text
!cpsup = txtCP.Text
.Update
End With
Datasup.Refresh
nonaktif
End Sub

Private Sub cmdTambah_Click()
Datasup.Recordset.AddNew
txtKoSup.MaxLength = 6 —-> Membatasi Penginputan sebanyak 6
aktif
bersih
End Sub
Private Sub Form_Activate()
txtCari.Enabled = True
txtCari.BackColor = &H80000005
tampil

End SubPrivate Sub Form_Load()
nonaktif
End Sub

Selamat Mencoba

Iklan

3 Comments

  1. bagus juga…….
    tapi aku mau minta tips yang lain seperti penjualan (yang gede qitu),
    dan aku pengen pelajarin cara buat running text dari visual basic6,kayak yang ada di jalan raya(mall),lampu lalu lintas……..
    plzzzzzzzzzzz

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