Buat Tampilan Sebagai berikut :
Tampilan Data Supplier :
![]()
Tampilan Browse Data Supplier :
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 SubPrivate Sub Form_Activate()
txtCari.Enabled = True
txtCari.BackColor = &H80000005
tampil
End SubPrivate Sub Form_Load()
nonaktif
End Sub
Selamat Mencoba