Program Entry-Edit Data



***DESIGN TABEL***


  1. Tabel Daftar Buku

Field Name
Type
Size
Kode_Buku
Text
10
Judul
Text
30
Jenis
Text
10
Jumlah
Integer
-
Harga
Long
-
      Index : xKode
                  Fieldnya Kode_Buku
                  Primary, Unique dan Required dicentang

  1. Tabel Daftar Anggota

Field Name
Type
Size
No_Anggota
Text
7
Nama
Text
30
Alamat
Text
40
No_Telepon
Text
15
      Index : xNomor
                  Fieldnya No_Anggota
                  Primary, Unique dan Required dicentang

  1. Tabel Daftar Sewa

Field Name
Type
Size
No_Sewa
Text
10
Kode_Buku
Text
10
Judul_Buku
Text
30
Nama_Penyewa
Text
30
Jaminan
Text
15
Tanggal_Pinjam
Text
25
Harga
Long
-
      Index : xSewa
                  Fieldnya No_Sewa
                  Primary, Unique dan Required tidak dicentang

  "TAMPILAN"















 

***MENU EDITOR***


*** MENU UTAMA***



Private Sub ID_Keluar_Click()
    End
End Sub

Private Sub ID_Keluar1_Click()
    End
End Sub

Private Sub ID_Keluar2_Click()
    End
End Sub

Private Sub ID_Kembali_Click()
    Pengembalian.Show
End Sub

Private Sub ID_LaporanAnggota_Click()
    LaporanAnggota.Show
End Sub

Private Sub ID_LaporanBuku_Click()
    LaporanBuku.Show
End Sub

Private Sub ID_Pinjam_Click()
    Peminjaman.Show
End Sub

Private Sub ID_TampilAnggota_Click()
    TampilAnggota.Show
End Sub

Private Sub ID_TampilBuku_Click()
    TampilBuku.Show
End Sub


***ENTRY DATA BUKU***



Dim DBuku As Database
Dim TBuku As Recordset

Private Sub SiapIsiForm()
    TJudul.Text = ""
    OptKomik.Enabled = True
    OptNovel.Enabled = True
    TJumlah.Text = ""
    THarga.Text = ""
End Sub

Private Sub TidakAktif()
    TJudul.Enabled = False
    OptKomik.Enabled = False
    OptNovel.Enabled = False
    TJumlah.Enabled = False
    THarga.Enabled = False
End Sub

Private Sub CSimpan_Click()
    TBuku.AddNew
    TBuku!Kode_Buku = TKode.Text
    TBuku!Judul = TJudul.Text
   
    If OptKomik.Value = True Then
        TBuku!Jenis = "Komik"
    Else
        TBuku!Jenis = "Novel"
    End If
    TBuku!Jumlah = Val(TJumlah.Text)
    TBuku!Harga = Val(THarga.Text)
    TBuku.Update
   
    SiapIsiForm
    TKode.Text = ""
    TKode.SetFocus
    OptKomik.Value = False
    OptNovel.Value = False
End Sub

Private Sub Form_Load()
    Set DBuku = OpenDatabase("D:\BKel4\Peminjaman_Buku.mdb")
    Set TBuku = DBuku.OpenRecordset("Daftar_Buku")
    TBuku.Index = "xKode"
   
    SiapIsiForm
    TKode.Text = ""
    TKode.Enabled = True
   
    CSimpan.Enabled = False
End Sub

Private Sub TKode_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then
        If TKode.Text = "" Then
            MsgBox "Ketik kodenya dulu donk....", vbOKOnly + vbInformation, "Informasi"
            TKode.SetFocus
            Exit Sub
        End If
       
        TBuku.Seek "=", TKode.Text
        If TBuku.NoMatch Then
            SiapIsiForm
            TJudul.Enabled = True
            OptKomik.Value = False
            OptNovel.Value = False
            TJumlah.Enabled = True
            THarga.Enabled = True
            TJudul.SetFocus
            Exit Sub
        Else
            TKode.Text = RTrim(TBuku!Kode_Buku)
            TJudul.Text = RTrim(TBuku!Judul)
           
            If RTrim(TBuku!Jenis) = "Komik" Then
                OptKomik.Value = True
            Else
                OptNovel.Value = True
            End If
            TJumlah.Text = RTrim(TBuku!Jumlah)
            THarga.Text = RTrim(TBuku!Harga)
            MsgBox "Maaf...kode buku " & RTrim(TKode.Text) & " sudah terdaftar, ganti kode buku yang lain ", vbOKOnly + vbInformation, "Peringatan"
            TidakAktif
            TKode.Text = ""
            TKode.SetFocus
            CSimpan.Enabled = False
        End If
    End If
End Sub

Private Sub THarga_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then
        CSimpan.SetFocus
    End If
End Sub

Private Sub CTutup_Click()
    Unload Me
End Sub

Private Sub TJumlah_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then
        THarga.SetFocus
    End If
End Sub

Private Sub TKode_Change()
    CSimpan.Enabled = True
End Sub


***EDIT DATA BUKU***



Dim DBuku As Database
Dim TBuku As Recordset

Private Sub CSimpan_Click()
    If TKode.Text = "" Then
        MsgBox "Ketik kodenya dulu donk....", vbOKOnly + vbInformation, "Informasi"
        TKode.SetFocus
        Exit Sub
    End If

    TBuku.Edit
    TBuku!Kode_Buku = TKode.Text
    TBuku!Judul = TJudul.Text
   
    If OptKomik.Value = True Then
        TBuku!Jenis = "Komik"
    Else
        TBuku!Jenis = "Novel"
    End If

    TBuku!Jumlah = Val(TJumlah.Text)
    TBuku!Harga = Val(THarga.Text)
    TBuku.Update

    SiapIsiForm
    TKode.Text = ""
    TKode.SetFocus
    OptKomik.Value = False
    OptNovel.Value = False
End Sub

Private Sub CTutup_Click()
    Unload Me
End Sub

Private Sub Form_Load()
    Set DBuku = OpenDatabase("D:\BKel4\Peminjaman_Buku.mdb")
    Set TBuku = DBuku.OpenRecordset("Daftar_Buku")
    TBuku.Index = "xKode"
   
    SiapIsiForm
    TKode.Text = ""
    TKode.Enabled = True

    CSimpan.Enabled = False
End Sub

Private Sub SiapIsiForm()
    TJudul.Text = ""
    OptKomik.Enabled = True
    OptNovel.Enabled = True
    TJumlah.Text = ""
    THarga.Text = ""
End Sub

Private Sub TidakAktif()
    TJudul.Enabled = False
    OptKomik.Enabled = False
    OptNovel.Enabled = False
    TJumlah.Enabled = False
    THarga.Enabled = False
End Sub

Private Sub TKode_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then
        If TKode.Text = "" Then
            MsgBox "Ketik kodenya dulu donk....", vbOKOnly + vbInformation, "Informasi"
            TKode.SetFocus
            Exit Sub
        End If
       
        TBuku.Seek "=", TKode.Text
        If TBuku.NoMatch Then
            SiapIsiForm
            MsgBox "Maaf...kode buku " & RTrim(TKode.Text) & " belum ada dalam daftar....", vbOKOnly + vbExclamation, "Peringatan"
           
            TidakAktif
            CSimpan.Enabled = False
   
            TKode.Text = ""
            TKode.SetFocus
            Exit Sub
        Else
            TJudul.Enabled = True
            OptKomik.Enabled = True
            OptNovel.Enabled = True
            TJumlah.Enabled = True
            THarga.Enabled = True
  
            TKode.Text = RTrim(TBuku!Kode_Buku)
            TJudul.Text = RTrim(TBuku!Judul)
           
            If RTrim(TBuku!Jenis) = "Komik" Then
                OptKomik.Value = True
            Else
                OptNovel.Value = True
            End If
           
            TJumlah.Text = RTrim(TBuku!Jumlah)
            THarga.Text = RTrim(TBuku!Harga)
            CSimpan.SetFocus
        End If
    End If
End Sub

Private Sub TKode_Change()
    CSimpan.Enabled = True
End Sub


***HAPUS DATA BUKU***



Dim DBuku As Database
Dim TBuku As Recordset

Private Sub SiapIsiForm()
    TJudul.Text = ""
    TJenis.Text = ""
    TJumlah.Text = ""
    THarga.Text = ""
End Sub

Private Sub TidakAktif()
    TJudul.Enabled = False
    TJenis.Enabled = False
    TJumlah.Enabled = False
    THarga.Enabled = False
End Sub

Private Sub CHapus_Click()
    Dim Respon As Integer
    Respon = MsgBox("Are you sure to delete this record.....", vbYesNo + vbInformation, "Peringatan")
    If Respon = 6 Then
        TBuku.Delete
        SiapIsiForm
        TidakAktif
        TKode.Enabled = True
        TKode.Text = ""
        TKode.SetFocus
    Else
        SiapIsiForm
        TidakAktif
        TKode.Enabled = True
        TKode.Text = ""
        TKode.SetFocus
    End If
End Sub

Private Sub CTutup_Click()
    Unload Me
End Sub

Private Sub Form_Load()
    Set DBuku = OpenDatabase("D:\BKel4\Peminjaman_Buku.mdb")
    Set TBuku = DBuku.OpenRecordset("Daftar_Buku")
    TBuku.Index = "xKode"
   
    SiapIsiForm
    TKode.Enabled = True
    CHapus.Enabled = False
End Sub

Private Sub TKode_Change()
    CHapus.Enabled = True
End Sub

Private Sub TKode_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then
        If TKode.Text = "" Then
            MsgBox "Ketik kode bukunya dulu donk....", vbOKOnly + vbInformation, "Informasi"
            TKode.SetFocus
            Exit Sub
        End If
       
        TBuku.Seek "=", TKode.Text
        If TBuku.NoMatch Then
            SiapIsiForm
            MsgBox "Maaf...kode buku " & RTrim(TKode.Text) & " tidak ada dalam daftar....", vbOKOnly + vbInformation, "Peringatan"   
            TidakAktif
            TKode.Text = ""
            TKode.SetFocus
            Exit Sub
        Else
            TKode.Enabled = True
            TJudul.Enabled = True
            TJenis.Enabled = True
            TJumlah.Enabled = True
            THarga.Enabled = True
           
            TKode.Text = RTrim(TBuku!Kode_Buku)
            TJudul.Text = RTrim(TBuku!Judul)
            TJenis.Text = RTrim(TBuku!Jenis)
            TJumlah.Text = RTrim(TBuku!Jumlah)
            THarga.Text = RTrim(TBuku!Harga)
            CHapus.SetFocus
        End If
    End If
End Sub


***TAMPIL DATA BUKU***



Private Sub CEdit_Click()
    EditBuku.Show
End Sub

Private Sub CEntry_Click()
    EntryBuku.Show
End Sub

Private Sub CHapus_Click()
    HapusBuku.Show
End Sub

Private Sub CTutup_Click()
    Unload Me
End Sub


***LAPORAN DATA BUKU***



Dim DBuku As Database
Dim TBuku As Recordset
Dim Nomor, sk As Integer

Private Sub CetakPreview()
    With Data1.Recordset
    .MoveFirst
        Do While Not .EOF
            If sk = 1 Then
                PreviewBuku.FontBold = True
                PreviewBuku.FontSize = 20
                PreviewBuku.Print
                PreviewBuku.Print Tab(15); "Laporan Daftar Buku";
                PreviewBuku.Print
                PreviewBuku.FontBold = False
                PreviewBuku.FontSize = 10
                PreviewBuku.Print
                PreviewBuku.Print
                PreviewBuku.Print String$(120, "=")
               
                PreviewBuku.FontBold = True
                PreviewBuku.Print Tab(7); "Kode Buku";
                PreviewBuku.Print Tab(20); "Judul";
                PreviewBuku.Print Tab(44); "Jenis";
                PreviewBuku.Print Tab(62); "Jumlah";
                PreviewBuku.Print Tab(82); "Harga";
                PreviewBuku.FontBold = False
                PreviewBuku.Print
                PreviewBuku.Print String$(120, "=")
               
                sk = 0
            End If
                PreviewBuku.Print Tab(8); !Kode_Buku;
                PreviewBuku.Print Tab(23); !Judul;
                PreviewBuku.Print Tab(50); !Jenis;
                PreviewBuku.Print Tab(72); !Jumlah;
                PreviewBuku.Print Tab(94); !Harga;
                .MoveNext
                Nomor = Nomor + 1
        Loop
            PreviewBuku.Print
            PreviewBuku.Print String$(120, "=")
            End With                           
End Sub

Private Sub CLayar_Click()
    Nomor = 1
    sk = 1
    PreviewBuku.Show
    CetakPreview
End Sub

Private Sub CSelesai_Click()
    DBuku.Close
    Unload Me
End Sub

Private Sub Form_Load()
    Set DBuku = OpenDatabase("D:\BKel4\Peminjaman_Buku.mdb")
    Set TBuku = DBuku.OpenRecordset("Daftar_Buku")
    TBuku.Index = "xKode"
    CPrinter.Enabled = False
End Sub


***PREVIEW DATA BUKU***




Private Sub Command1_Click()
    Unload Me
End Sub


***ENTRY DATA ANGGOTA***



Dim DAnggota As Database
Dim TAnggota As Recordset

Private Sub SiapIsiForm()
    TNama.Text = ""
    TAlamat.Text = ""
    TTelepon.Text = ""
End Sub

Private Sub TidakAktif()
    TNama.Enabled = False
    TAlamat.Enabled = False
    TTelepon.Enabled = False
End Sub

Private Sub CSimpan_Click()
    TAnggota.AddNew
    TAnggota!No_Anggota = TNomor.Text
    TAnggota!Nama = TNama.Text
    TAnggota!Alamat = TAlamat.Text
    TAnggota!No_Telepon = Val(TTelepon.Text)
    TAnggota.Update
   
    SiapIsiForm
    TNomor.Text = ""
    TNomor.SetFocus
End Sub

Private Sub Form_Load()
    Set DAnggota = OpenDatabase("D:\BKel4\Peminjaman_Buku.mdb")
    Set TAnggota = DAnggota.OpenRecordset("Daftar_Anggota")
    TAnggota.Index = "xNomor"
   
    TNomor.Text = ""
   
    SiapIsiForm
    TNomor.Enabled = True
   
    CSimpan.Enabled = False
End Sub

Private Sub TNomor_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then
        If TNomor.Text = "" Then
            MsgBox "Ketik nomor anggotanya dulu donk....", vbOKOnly + vbInformation, "Informasi"
            TNomor.SetFocus
            Exit Sub
        End If
        TAnggota.Seek "=", TNomor.Text
        If TAnggota.NoMatch Then
            SiapIsiForm
            TNama.Enabled = True
            TAlamat.Enabled = True
            TTelepon.Enabled = True
            TNama.SetFocus
            Exit Sub
        Else
            TNomor.Text = RTrim(TAnggota!No_Anggota)
            TNama.Text = RTrim(TAnggota!Nama)
            TAlamat.Text = RTrim(TAnggota!Alamat)
            TTelepon.Text = RTrim(TAnggota!No_Telepon)
            MsgBox "Maaf...nomor anggota " & RTrim(TNomor.Text) & " sudah terdaftar, ganti dengan nomor yang lain ", vbOKOnly + vbInformation, "Peringatan"
            TidakAktif
            TNomor.Text = ""
            TNomor.SetFocus
            CSimpan.Enabled = False
        End If
    End If
End Sub

Private Sub TTelepon_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then
        CSimpan.SetFocus
    End If
End Sub

Private Sub CTutup_Click()
    Unload Me
End Sub

Private Sub TNama_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then
        TAlamat.SetFocus
    End If
End Sub

Private Sub TNomor_Change()
    CSimpan.Enabled = True
End Sub

Private Sub TAlamat_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then
        TTelepon.SetFocus
    End If
End Sub


 ***EDIT DATA ANGGOTA***


Dim DAnggota As Database
Dim TAnggota As Recordset

Private Sub SiapIsiForm()
    TNama.Text = ""
    TAlamat.Text = ""
    TTelepon.Text = ""
End Sub

Private Sub TidakAktif()
    TNama.Enabled = False
    TAlamat.Enabled = False
    TTelepon.Enabled = False
End Sub

Private Sub CTutup_Click()
    Unload Me
End Sub

Private Sub CSimpan_Click()
    TAnggota.Edit
    TAnggota!Nama = TNama.Text
    TAnggota!Alamat = TAlamat.Text
    TAnggota!No_Telepon = Val(TTelepon.Text)
    TAnggota.Update
   
    SiapIsiForm
    TNomor.Text = ""
    TNomor.SetFocus
End Sub



Private Sub Form_Load()
    Set DAnggota = OpenDatabase("D:\BKel4\Peminjaman_Buku.mdb")
    Set TAnggota = DAnggota.OpenRecordset("Daftar_Anggota")
    TAnggota.Index = "xNomor"
   
    TNomor.Text = ""
   
    SiapIsiForm
    TNomor.Enabled = True
   
    CSimpan.Enabled = False
End Sub

Private Sub TNomor_Change()
    CSimpan.Enabled = True
End Sub

Private Sub TNomor_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then
        If TNomor.Text = "" Then
            MsgBox "Ketik nomor anggotanya dulu donk....", vbOKOnly + vbInformation, "Informasi"
            TNomor.SetFocus
            Exit Sub
        End If
       
        TAnggota.Seek "=", TNomor.Text
        If TAnggota.NoMatch Then
            SiapIsiForm
            MsgBox "Maaf...nomor anggota " & RTrim(TNomor.Text) & " belum ada dalam daftar....", vbOKOnly + vbExclamation, "Peringatan"
           
            TidakAktif
            CSimpan.Enabled = False
   
            TNomor.Text = ""
            TNomor.SetFocus
            Exit Sub
        Else
            TNomor.Enabled = True
            TNama.Enabled = True
            TAlamat.Enabled = True
            TTelepon.Enabled = True
           
            TNomor.Text = RTrim(TAnggota!No_Anggota)
            TNama.Text = RTrim(TAnggota!Nama)
            TAlamat.Text = RTrim(TAnggota!Alamat)
            TTelepon.Text = RTrim(TAnggota!No_Telepon)
            CSimpan.SetFocus
        End If
    End If
End Sub


***HAPUS DATA ANGGOTA***
  

Dim DAnggota As Database
Dim TAnggota As Recordset

Private Sub SiapIsiForm()
    TNama.Text = ""
    TAlamat.Text = ""
    TTelepon.Text = ""
End Sub

Private Sub TidakAktif()
    TNama.Enabled = False
    TAlamat.Enabled = False
    TTelepon.Enabled = False
End Sub

Private Sub CHapus_Click()
    Dim Respon As Integer
    Respon = MsgBox("Are you sure to delete this record.....", vbYesNo + vbInformation, "Peringatan")
    If Respon = 6 Then
        TAnggota.Delete
        SiapIsiForm
        TidakAktif
        TNomor.Enabled = True
        TNomor.Text = ""
        TNomor.SetFocus
    Else
        SiapIsiForm
        TidakAktif
        TNomor.Enabled = True
        TNomor.Text = ""
        TNomor.SetFocus
    End If
End Sub

Private Sub CTutup_Click()
    Unload Me
End Sub

Private Sub Form_Load()
    Set DAnggota = OpenDatabase("D:\BKel4\Peminjaman_Buku.mdb")
    Set TAnggota = DAnggota.OpenRecordset("Daftar_Anggota")
    TAnggota.Index = "xNomor"
   
    SiapIsiForm
    TNomor.Enabled = True
    CHapus.Enabled = False
End Sub

Private Sub TNomor_Change()
    CHapus.Enabled = True
End Sub

Private Sub TNomor_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then
        If TNomor.Text = "" Then
            MsgBox "Ketik nomor anggotanya dulu donk....", vbOKOnly + vbInformation, "Informasi"
            TNomor.SetFocus
            Exit Sub
        End If
       
        TAnggota.Seek "=", TNomor.Text
        If TAnggota.NoMatch Then
            SiapIsiForm
            MsgBox "Maaf...nomor anggota " & RTrim(TKode.Text) & " tidak ada dalam daftar....", vbOKOnly + vbInformation, "Peringatan"
           
            TidakAktif
            TNomor.Text = ""
            TNomor.SetFocus
            Exit Sub
        Else
            TNomor.Enabled = True
            TNama.Enabled = True
            TAlamat.Enabled = True
            TTelepon.Enabled = True
           
            TNomor.Text = RTrim(TAnggota!No_Anggota)
            TNama.Text = RTrim(TAnggota!Nama)
            TAlamat.Text = RTrim(TAnggota!Alamat)
            TTelepon.Text = RTrim(TAnggota!No_Telepon)
            CHapus.SetFocus
        End If
    End If
End Sub


***TAMPIL DATA ANGGOTA***


Private Sub CEdit_Click()
    EditAnggota.Show
End Sub


Private Sub CEntry_Click()
    EntryAnggota.Show
End Sub

Private Sub CHapus_Click()
    HapusAnggota.Show
End Sub

Private Sub CTutup_Click()
    Unload Me
End Sub


***LAPORAN DATA ANGGOTA***


Dim DBuku As Database
Dim TBuku As Recordset
Dim Nomor, sk As Integer

Private Sub CetakPreview()
    With Data1.Recordset
    .MoveFirst
        Do While Not .EOF
            If sk = 1 Then
                PreviewAnggota.FontBold = True
                PreviewAnggota.FontSize = 20
                PreviewAnggota.Print
                PreviewAnggota.Print Tab(15); "Laporan Daftar Anggota";
                PreviewAnggota.Print
                PreviewAnggota.FontBold = False
                PreviewAnggota.FontSize = 10
                PreviewAnggota.Print
                PreviewAnggota.Print
                PreviewAnggota.Print String$(120, "=")
               
                PreviewAnggota.FontBold = True
                PreviewAnggota.Print Tab(7); "No. Anggota";
                PreviewAnggota.Print Tab(27); "Nama";
                PreviewAnggota.Print Tab(44); "Alamat";
                PreviewAnggota.Print Tab(72); "No. Telepon";
                PreviewAnggota.FontBold = False
                PreviewAnggota.Print
                PreviewAnggota.Print String$(120, "=")
               
                sk = 0
            End If
                PreviewAnggota.Print Tab(8); !No_Anggota;
                PreviewAnggota.Print Tab(31); !Nama;
                PreviewAnggota.Print Tab(50); !Alamat;
                PreviewAnggota.Print Tab(82); !No_Telepon;
                .MoveNext
                Nomor = Nomor + 1
        Loop
            PreviewAnggota.Print
            PreviewAnggota.Print String$(120, "=")
            End With                       
End Sub

Private Sub CLayar_Click()
    Nomor = 1
    sk = 1
    PreviewAnggota.Show
    CetakPreview
End Sub

Private Sub CSelesai_Click()
    DBuku.Close
    Unload Me
End Sub

Private Sub Form_Load()
    Set DBuku = OpenDatabase("D:\BKel4\Peminjaman_Buku.mdb")
    Set TBuku = DBuku.OpenRecordset("Daftar_Anggota")
    TBuku.Index = "xNomor"
    CPrinter.Enabled = False
End Sub


***PREVIEW DATA ANGGOTA***


Private Sub Command1_Click()
    Unload Me
End Sub


***DATA PEMINJAMAN***


Dim DPinjam As Database
Dim TBuku As Recordset
Dim TAnggota As Recordset
Dim TSewa As Recordset

Private Sub SiapIsiForm()
    TNoSewa.Text = ""
    TKode.Text = ""
    TJudul.Text = ""
    Combo1.Text = ""
    TNoAnggota.Text = ""
    TNama.Text = ""
    TTanggal.Text = ""
    THarga.Text = ""
End Sub

Private Sub Combo1_KeyPress(KeyAscii As Integer)
 If KeyAscii = 13 Then
        If Combo1.Text = "" Then
            MsgBox "Pilih jaminannya dulu donk....", vbOKOnly + vbInformation, "Informasi"
            Combo1.SetFocus
            Exit Sub
        End If
       
        If Combo1.Text = "Kartu Anggota" Then
            TNoAnggota.Text = ""
            TNoAnggota.SetFocus
        Else
            TNoAnggota.Text = "-"
            TNama.SetFocus
        End If
    End If
End Sub

Private Sub CSimpan_Click()
    TSewa.AddNew
    TSewa!No_Sewa = TNoSewa.Text
    TSewa!Kode_Buku = TKode.Text
    TSewa!Jaminan = Combo1.Text
    TSewa!Nama_Penyewa = TNama.Text
    TSewa!Harga = THarga.Text
    TSewa!Tanggal_Pinjam = TTanggal.Text
    TSewa!Judul_Buku = TJudul.Text
    TSewa.Update
   
    TBuku.Edit
    Jumlah = TBuku!Jumlah - 1
    TBuku!Jumlah = Jumlah
    TBuku.Update
   
    SiapIsiForm
    TNoSewa.SetFocus
End Sub

Private Sub CTutup_Click()
    Unload Me
End Sub

Private Sub DTPicker1_Change()
    TTanggal.SetFocus
    TTanggal.Text = DTPicker1.Value
End Sub

Private Sub Form_Load()
    Set DPinjam = OpenDatabase("D:\BKel4\Peminjaman_Buku.mdb")
    Set TBuku = DPinjam.OpenRecordset("Daftar_Buku")
    Set TAnggota = DPinjam.OpenRecordset("Daftar_Anggota")
    Set TSewa = DPinjam.OpenRecordset("Daftar_Sewa")
    TBuku.Index = "xKode"
    TAnggota.Index = "xNomor"
   
    SiapIsiForm
    TNoSewa.Enabled = True
   
    Combo1.AddItem "Kartu Anggota"
    Combo1.AddItem "Kartu OSIS"
    Combo1.AddItem "KTP"
    Combo1.AddItem "SIM"
   
    CSimpan.Enabled = False
    DTPicker1.Value = Now
End Sub
Private Sub TKode_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then
        If TKode.Text = "" Then
            MsgBox "Ketik kode bukunya dulu donk....", vbOKOnly + vbInformation, "Informasi"
            TKode.SetFocus
            Exit Sub
        End If
       
        TBuku.Seek "=", TKode.Text
        If TBuku.NoMatch Then
            MsgBox "Kode buku belum ada dalam daftar....", vbOKOnly + vbInformation, "Informasi"
            TKode.Text = ""
            TKode.SetFocus
            Exit Sub
        Else
            If TBuku!Jumlah = 0 Then
                MsgBox "Semua buku sedang keluar....", vbOKOnly + vbInformation, "Informasi"
                TKode.Text = ""
                TKode.SetFocus
                Exit Sub
            End If
           
            TKode.Text = RTrim(TBuku!Kode_Buku)
            TJudul.Text = RTrim(TBuku!Judul)
            THarga.Text = RTrim(TBuku!Harga)
            Combo1.SetFocus
        End If
    End If
End Sub

Private Sub TNoAnggota_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then
        If TNoAnggota.Text = "" Then
            MsgBox "Ketik nomor anggotanya dulu donk....", vbOKOnly + vbInformation, "Informasi"
            TKode.SetFocus
            Exit Sub
        End If
       
        TAnggota.Seek "=", TNoAnggota.Text
        If TAnggota.NoMatch Then
            MsgBox "Cek lagi nomor anggotanya ya....", vbOKOnly + vbInformation, "Informasi"
            TNoAnggota.Text = ""
            TNoAnggota.SetFocus
            Exit Sub
        Else
            TNama.Text = TAnggota!Nama
            DTPicker1.SetFocus
        End If
    End If
End Sub

Private Sub TNoSewa_Change()
    CSimpan.Enabled = True
End Sub

Private Sub TNoSewa_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then
        If TNoSewa.Text = "" Then
            MsgBox "Ketik nomor sewanya dulu donk....", vbOKOnly + vbInformation, "Informasi"
            TNoSewa.SetFocus
            Exit Sub
        End If
        TKode.SetFocus
    End If
End Sub

Private Sub TTanggal_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then
        CSimpan.SetFocus
    End If
End Sub


***DATA PENGEMBALIAN***


Dim DPengembalian As Database
Dim TBuku As Recordset
Dim TAnggota As Recordset
Dim TSewa As Recordset
Private Sub SiapIsiForm()
    TNoSewa.Text = ""
    TKode.Text = ""
    TJudul.Text = ""
    TJaminan.Text = ""
    TNama.Text = ""
    TTanggal.Text = ""
    TPinjam.Text = ""
    TDenda.Text = ""
End Sub

Private Sub CSimpan_Click()
    Dim Respon As Integer
    Respon = MsgBox("Benarkah Anda mau menghapus data ini.....", vbYesNo + vbInformation, "Informasi")
    If Respon = 6 Then
        TSewa.Delete
        SiapIsiForm
        TNoSewa.SetFocus
    Else
        SiapIsiForm
        TNoSewa.SetFocus
    End If
   
    TBuku.Edit
    Jumlah = TBuku!Jumlah + 1
    TBuku!Jumlah = Jumlah
    TBuku.Update
End Sub

Private Sub DTPicker1_Change()
    TTanggal.SetFocus
    TTanggal.Text = DTPicker1.Value
End Sub

Private Sub CTutup_Click()
    Unload Me
End Sub

Private Sub Form_Load()
    Set DPengembalian = OpenDatabase("D:\BKel4\Peminjaman_Buku.mdb")
    Set TBuku = DPengembalian.OpenRecordset("Daftar_Buku")
    Set TAnggota = DPengembalian.OpenRecordset("Daftar_Anggota")
    Set TSewa = DPengembalian.OpenRecordset("Daftar_Sewa")
    TBuku.Index = "xKode"
    TAnggota.Index = "xNomor"
    TSewa.Index = "xSewa"
   
    SiapIsiForm
    TNoSewa.Enabled = True
   
    CSimpan.Enabled = False
    DTPicker1.Value = Now
End Sub

Private Sub TNoSewa_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then
        If TNoSewa.Text = "" Then
            MsgBox "Ketik nomor sewanya dulu donk....", vbOKOnly + vbInformation, "Informasi"
            TNoSewa.SetFocus
            Exit Sub
        End If
       
        TSewa.Seek "=", TNoSewa.Text
        If TSewa.NoMatch Then
            MsgBox "Cek lagi nomor sewanya ya....", vbOKOnly + vbInformation, "Informasi"
            TNoSewa.Text = ""
            TNoSewa.SetFocus
            Exit Sub
        Else
            TNoSewa.Enabled = True
            TKode.Enabled = True
            TJudul.Enabled = True
            TNama.Enabled = True
            TJaminan.Enabled = True
            TPinjam.Enabled = True
            TTanggal.Enabled = True
            TDenda.Enabled = True
           
            TNoSewa.Text = RTrim(TSewa!No_Sewa)
            TKode.Text = RTrim(TSewa!Kode_Buku)
            TNama.Text = RTrim(TSewa!Nama_Penyewa)
            TJaminan.Text = RTrim(TSewa!Jaminan)
            TPinjam.Text = RTrim(TSewa!Tanggal_Pinjam)
            TJudul.Text = RTrim(TSewa!Judul_Buku)
           
            DTPicker1.SetFocus
        End If
    End If
End Sub

Private Sub TNoSewa_Change()
    CSimpan.Enabled = True
End Sub

Private Sub TTanggal_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then
        Hari = Val(TTanggal.Text) - Val(TSewa!Tanggal_Pinjam)
        If (Hari = 0) Or (Hari <= 3) Then
            TDenda.Text = "-"
        ElseIf Hari > 3 Then
            TDenda.Text = (Hari - 3) * 500
        End If
       
        CSimpan.SetFocus
    End If
End Sub


0 Comments:

Posting Komentar



Datos personales

Foto Saya
Novika Ratna Nuriani
unpredictable....
Lihat profil lengkapku

Followers

Entri Populer

Cari Blog Ini

Pages