Listingnya Nih, Tapi Jangan Lupa Buat Dulu Database dan Field-Fieldnya sesuai dengan Form yang diatas, dan Nama Object di Formnya juga jangan lupa disesuaikan kawan.
Dim a As ListItem Sub nomor() Dim no, oto As String Adodc1.RecordSource = "select * from buku" Adodc1.Refresh If Adodc1.Recordset.RecordCount = 0 Then oto = "BSI-001" Else Adodc1.Recordset.MoveLast no = Right(Adodc1.Recordset!kd_buku, 3) + 1 oto = "BSI-" & Right("00" & no, 3) End If tkode.Text = oto End Sub Sub tampil() With Adodc1.Recordset tkode.Text = !kd_buku tjudul.Text = !judul_buku tpenerbit.Text = !penerbit tpengarang.Text = !pengarang cbtahun.Text = !thn_terbit tjumlah.Text = !jml_buku End With End Sub Private Sub cmdbatal_Click() nonaktif bersih cmdtambah.SetFocus End Sub Private Sub cmdbersih_Click() bersih End Sub Private Sub cmdcari_Click() If opt1.Value = True Then Adodc1.RecordSource = "select * from buku where kd_buku='" & tcari.Text & "'" Adodc1.Refresh If Adodc1.Recordset.RecordCount = 0 Then MsgBox "Data Tidak Ada" End If tampil Else If opt2.Value = True Then Adodc1.RecordSource = "select * from buku where thn_terbit='" & tcari.Text & "'" Adodc1.Refresh tampil If Adodc1.Recordset.RecordCount = 0 Then MsgBox "Data Tidak Ada" End If tampil Else MsgBox " Masukan Pilihan Anda Terlebih Dahulu !! " End If End If End Sub Private Sub cmdedit_Click() If tkode.Text <> "" Then If cmdedit.Caption = "Edit" Then aktif cmdedit.Caption = "UPDATE" Else With Adodc1.Recordset !kd_buku = tkode.Text !judul_buku = tjudul.Text !penerbit = tpenerbit.Text !pengarang = tpengarang.Text !thn_terbit = cbtahun.Text !jml_buku = tjumlah.Text End With bersih nonaktif cmdedit.Caption = "Edit" ListView1.Refresh End If Else MsgBox "Tidak Ada data Yang Di Edit", vbOKOnly + vbInformation, "Pesan" End If End Sub Private Sub cmdfirst_Click() On Error Resume Next Adodc1.Recordset.MoveFirst tampil End Sub Private Sub cmdhapus_Click() i = InputBox("Masukan Berdasarkan Kode Barang : ", "Pencarian Data") Adodc1.RecordSource = "select * from buku where kd_buku='" & i & "'" Adodc1.Refresh tampil If Adodc1.Recordset.RecordCount = 0 Then MsgBox "Data Tidak Ada" Else a = MsgBox("Yakin Data Akan Di Hapus??", vbOKCancel, "Konfirmasi") If a = vbOK Then Adodc1.Recordset.Delete End If End If End Sub Private Sub cmdlast_Click() On Error Resume Next Adodc1.Recordset.MoveLast tampil End Sub Private Sub cmdnext_Click() On Error Resume Next If Adodc1.Recordset.EOF Then MsgBox "Anda Berada di Akhir record !!" Else Adodc1.Recordset.MoveNext tampil End If End Sub Private Sub cmdprev_Click() On Error Resume Next If Adodc1.Recordset.BOF Then MsgBox "Anda Berada di Awal record !!" Else Adodc1.Recordset.MovePrevious tampil End If End Sub Private Sub cmdsimpan_Click() Adodc1.RecordSource = "select * from buku" Adodc1.Refresh With Adodc1.Recordset .AddNew !kd_buku = tkode.Text !judul_buku = tjudul.Text !penerbit = tpenerbit.Text !pengarang = tpengarang.Text !thn_terbit = cbtahun.Text !jml_buku = tjumlah.Text .Update End With For i = 1 To ListView1.ListItems.Count Adodc1.RecordSource = "select * from buku where kd_buku =""" & ListView1.ListItems(i) & """" Adodc1.Refresh If Adodc1.Recordset.RecordCount = 0 Then Adodc1.Recordset.AddNew Adodc1.Recordset!kd_buku = ListView1.ListItems(i).SubItems(1) Adodc1.Recordset!judul_buku = ListView1.ListItems(i).SubItems(2) Adodc1.Recordset!penerbit = ListView1.ListItems(i).SubItems(3) Adodc1.Recordset!pengarang = ListView1.ListItems(i).SubItems(4) Adodc1.Recordset!thn_terbit = ListView1.ListItems(i).SubItems(5) Adodc1.Recordset!jml_buku = ListView1.ListItems(i).SubItems(6) Adodc1.Recordset.Update End If Next bersih End Sub Private Sub cmdtambah_Click() aktif nomor tkode.SetFocus End Sub Private Sub Form_Load() Dim tahun As Integer Adodc1.ConnectionString = " Provider =Microsoft.Jet.OLEDB.4.0;Data Source =" & App.Path + "\perpuspuspus.mdb" Adodc1.RecordSource = "select * from buku" Adodc1.Refresh Do While Not Adodc1.Recordset.EOF Set a = ListView1.ListItems.Add() a.Text = "" a.SubItems(1) = Adodc1.Recordset.Fields(0) a.SubItems(2) = Adodc1.Recordset!judul_buku a.SubItems(3) = Adodc1.Recordset!penerbit a.SubItems(4) = Adodc1.Recordset!pengarang a.SubItems(5) = Adodc1.Recordset!thn_terbit a.SubItems(6) = Adodc1.Recordset!jml_buku Adodc1.Recordset.MoveNext Loop tahun = 1980 While tahun < 2030 cbtahun.AddItem tahun tahun = tahun + 1 Wend nonaktif End Sub Sub bersih() tkode.Text = "" tjudul.Text = "" tpenerbit.Text = "" tpengarang.Text = "" cbtahun.Text = "" tjumlah.Text = "" tcari.Text = "" opt1.Value = False opt2.Value = False End Sub Sub aktif() tkode.Enabled = True tjudul.Enabled = True tpenerbit.Enabled = True tpengarang.Enabled = True cbtahun.Enabled = True tjumlah.Enabled = True tcari.Enabled = True opt1.Enabled = True opt2.Enabled = True cmdsimpan.Enabled = True cmdbatal.Enabled = True cmdcari.Enabled = True cmdhapus.Enabled = True cmdbersih.Enabled = True End Sub Sub nonaktif() tkode.Enabled = False tjudul.Enabled = False tpenerbit.Enabled = False tpengarang.Enabled = False cbtahun.Enabled = False tjumlah.Enabled = False tcari.Enabled = False opt1.Enabled = False opt2.Enabled = False cmdsimpan.Enabled = False cmdbatal.Enabled = False cmdcari.Enabled = False cmdhapus.Enabled = False cmdbersih.Enabled = False End Sub Private Sub Image1_Click() Image1.BorderStyle = 1 y = MsgBox("Yakin Akan Keluar ?? ", vbYesNo + vbQuestion, "Perpustakaan") If y = vbYes Then End Else Image1.BorderStyle = 0 End If End Sub Private Sub Timer1_Timer() Label8.Caption = Format(Date, "long date") Label9.Caption = Time End Sub Private Sub Timer2_Timer() Label7.ForeColor = RGB(Rnd * 255, Rnd * 255, Rnd * 255) End Sub