Showing posts with label Visual Basic. Show all posts
Showing posts with label Visual Basic. Show all posts

Membuat Penomoran Otomatis Sederhana (VB 6.0)

Bissmillahirrahmanirrahim .....

Assalamualaikum,,
lagi asik ngoding nih saya, sambil dengerin lagu-lagu rhoma irama, asyikk nyaaa.. 
haha, dan tiba-tiba saya ingat sama blog lagi, tiba-tiba saya ingin berbagi lagi .. 



Kali ini saya mau bahas tentang penomoran otomatis,  mungkin sebagian banyak blog-blog sudah membuat bahasan ini, tapi untuk memudahkan teman-teman yang membutuhkan penomoran otomatis ini ya saya mau berbagi kemampuan saya sama kalian..

Penomoran otomatis merupakan sebuah metode atau cara yang digunakan dalam sebuah program untuk mempermudah mengklasifikasikan data sesuai identitas data itu sendiri, data yang sifatnya kontinu akan sangat merepotkan apa bisa dibuat dan atau diinput secara manual, guna mempermudah hal tersebuh dan sekaligus meminimalisir kesalahan, maka perlu dibuatkan penomoran otomatis sesuai dengan yang diperlukan oleh data tersebut.
Aplikasi Perhitungan Sederhana Pisan ..

Aplikasi Perhitungan Sederhana Pisan ..

Posting Lagii Ahh ....

Postingan Kali ini Masih Seputaran Program juga nih, heheh....
program buatan temen saya yang biasa saya panggil taplak.. :P
ok, Program Sederhananya tentang perhitungan Bangun Ruang 
dan Bangun datar, Aplikasi yang ditujukan untuk anak kecil yang malas berhitung .. :D
Nih Aplikasinya sayah langsung kasih sajah .. :D
Namanya, MathNgunTaRang = Matematika Bangun Datar dan Ruang ... hehehhe





Form Master Buku "Perpustakaan Sederhana"



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

Form Petugas "Perpustakaan Sederhana"


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.



Sub aktif()
Dim h As Control
For Each h In Me
If TypeOf h Is TextBox Then h.Enabled = True
Next
End Sub

Sub bersih()
Dim h As Control
For Each h In Me
If TypeOf h Is TextBox Then h.Text = ""
If TypeOf h Is ComboBox Then h.Text = ""
Next
End Sub

Sub non()
Dim h As Control
For Each h In Me
If TypeOf h Is TextBox Then h.Enabled = False
Next
End Sub

Sub tampil()
With Adodc1.Recordset
        tkd_petugas = !kd_petugas
        tnm_petugas = !nm_petugas
End With
End Sub

Private Sub ccancel_Click()
h = MsgBox("Batalkan?", vbYesNo + vbQuestion, "Perpustakaan Bhendy | Konfirmasi")
If h = vbYes Then
   bersih
End If
End Sub

Private Sub cclose_Click()
h = MsgBox("Quit this application??", vbYesNo + vbQuestion, " Perpustakaan Bhendy | Konfirmasi ")
If h = vbYes Then
   Unload Me
End If
End Sub

Private Sub cdelete_Click()
If tkd_petugas.Text = "" Or tnm_petugas.Text = "" Then
MsgBox "Masukan Data yang Akan Di Hapus Terlebih Dahulu !!"
Else
h = MsgBox("Hapus Data Petugas??", vbYesNo + vbQuestion, " Perpustakaan Bhendy | Konfirmasi ")
If h = vbYes Then
   Adodc1.Recordset.Delete
   MsgBox "Data Telah Dihapus!!!", vbOKOnly + vbInformation, " Perpustakaan Bhendy | Informasi"
   bersih
End If
End If
End Sub

Private Sub cedit_Click()
If tkd_petugas <> "" Then
    If cedit.Caption = "&EDIT" Then
    aktif
    cedit.Caption = "UPDATE"
        Else
            With Adodc1.Recordset
                !kd_petugas = tkd_petugas
                !nm_petugas = tnm_petugas
                .Update
            End With
        bersih
        cedit.Caption = "&EDIT"
    End If
Else
MsgBox "Tidak Ada data Yang Di Edit", vbOKOnly + vbInformation, " Perpustakaan Bhendy | Informasi"
End If
End Sub

Private Sub cfirst_Click()
On Error Resume Next
Adodc1.Recordset.MoveFirst
tampil
End Sub

Private Sub clast_Click()
On Error Resume Next
Adodc1.Recordset.MoveLast
tampil
End Sub

Private Sub cnew_Click()
aktif
bersih
tkd_petugas.SetFocus
End Sub

Private Sub cnext_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 cprev_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 csave_Click()
Adodc1.RecordSource = "select * from tblpetugas"
Adodc1.Refresh
If tkd_petugas.Text = "" Or tnm_petugas.Text = "" Then
   MsgBox "Data Belum Lengkap!!!", vbOKOnly + vbCritical, " Perpustakaan Bhendy | Informasi"
Else
   With Adodc1.Recordset
        .AddNew
        !kd_petugas = tkd_petugas.Text
        !nm_petugas = tnm_petugas
        .Update
        MsgBox "Data Sudah Disimpan!!!", vbOKOnly + vbInformation, " Perpustakaan Bhendy | Informasi"
        bersih
        non
   End With
   DataGrid1.Refresh
End If
End Sub

Private Sub DataGrid1_Click()
tampil
End Sub

Private Sub Form_Load()
bersih
non

Adodc1.Visible = False
Adodc1.ConnectionString = "Provider = Microsoft.Jet.OLEDB.4.0;Data source = " & App.Path & "\perpustakaan.mdb"
Adodc1.RecordSource = "select * from tblpetugas"
Adodc1.Refresh
End Sub

Private Sub Timer1_Timer()
Label1.Caption = Right(Label1.Caption, Len(Label1.Caption) - 1) & Left(Label1.Caption, 1)
End Sub

Private Sub tkd_petugas_KeyPress(KeyAscii As Integer)
KeyAscii = Asc(UCase(Chr(KeyAscii))) ‘Huruf Kapital
If KeyAscii = 13 Then
   Adodc1.RecordSource = "select * from tblpetugas where kd_petugas = '" & tkd_petugas.Text & "'"
   Adodc1.Refresh
   If Adodc1.Recordset.EOF = False Then
           MsgBox "Kode sudah ada"
           bersih
           tkd_petugas.SetFocus
   Else
           tkd_petugas.Enabled = False
           tnm_petugas.SetFocus
   End If
End If
End Sub

Form Anggota "Perpustakaan Sederhana"



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.


Private Sub cfirst_Click()
On Error Resume Next
Adodc1.Recordset.MoveFirst
End Sub

Private Sub clast_Click()
On Error Resume Next
Adodc1.Recordset.MoveLast
End Sub

Private Sub cmdadd_Click()
aktif
bersih
nomat
tnama.SetFocus
End Sub

Sub nomat()
Dim no, oto As String
Adodc1.RecordSource = "select * from tblanggota"
Adodc1.Refresh
If Adodc1.Recordset.RecordCount = 0 Then
    oto = "AA001"
    Else
        Adodc1.Recordset.MoveLast
        no = Right(Adodc1.Recordset.Fields(0), 3) + 1
        oto = "AA" & Right("00" & no, 3)
    End If
tkode = oto
End Sub

Private Sub cmdcancel_Click()
non
bersih
cmdexit.Enabled = True
cmdadd.Enabled = True
cfirst.Enabled = True
cprev.Enabled = True
cnext.Enabled = True
clast.Enabled = True
cmdedit.Caption = "EDIT"
End Sub

Private Sub cmdclean_Click()
bersih
Combo1.Text = ""
End Sub

Private Sub cmddelete_Click()
i = InputBox("Masukan Kode Buku :", "Perpustakan")
Adodc1.RecordSource = " Select * from tblanggota where kd_anggota= '" & i & "'"
Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
    tampil
    h = MsgBox("Hapus Data Ini ??", vbYesNo + vbQuestion, "Perpustakaan")
    If h = vbYes Then
        Adodc1.Recordset.Delete
        bersih
    End If
Else
MsgBox "Data Tidak Ditemukan"
End If
End Sub

Private Sub cmdedit_Click()
If tkode <> "" Then
    If cmdedit.Caption = "EDIT" Then
    aktif
    cmdedit.Caption = "UPDATE"
        Else
            With Adodc1.Recordset
                 .Fields(0) = tkode
                 .Fields(1) = tnama
                 .Fields(2) = tnim
                 .Fields(3) = Combo1
                 If opt1.Value = True Then .Fields(4) = "L"
                 If opt2.Value = True Then .Fields(4) = "P"
                 .Fields(5) = talamat
                 .Fields(6) = DTPicker1.Value
                 .Fields(7) = ttelp
            End With
        bersih
        cmdedit.Caption = "EDIT"
    End If
Else
MsgBox "Tidak Ada data Yang Di Edit", vbOKOnly + vbInformation, "Pesan"
End If
End Sub

Sub tampil()
With Adodc1.Recordset
     tkode = .Fields(0)
     tnama = .Fields(1)
     tnim = .Fields(2)
     Combo1 = .Fields(3)
     If .Fields(4) = L Then opt1.Value = True
     If .Fields(4) = P Then opt2.Value = True
     talamat = .Fields(5)
     DTPicker1.Value = .Fields(6)
     ttelp = .Fields(7)
End With
End Sub

Private Sub cmdexit_Click()
h = MsgBox("Yakin Akan Keluar ???", vbYesNo + vbQuestion, "Perpustakaan")
If h = vbYes Then
    Unload Me
End If
End Sub

Private Sub cmdsave_Click()
Adodc1.RecordSource = " Select * From tblanggota"
Adodc1.Refresh
With Adodc1.Recordset
    .AddNew
    .Fields(0) = tkode
    .Fields(1) = tnama
    .Fields(2) = tnim
    .Fields(3) = Combo1
    If opt1.Value = True Then .Fields(4) = "L"
    If opt2.Value = True Then .Fields(4) = "P"
    .Fields(5) = talamat
    .Fields(6) = DTPicker1.Value
    .Fields(7) = ttelp
    .Update
End With
bersih
MsgBox "Data Berhasil Disimpan !!!!"
End Sub

Private Sub cnext_Click()
On Error Resume Next
If Adodc1.Recordset.EOF Then
    MsgBox "Anda Berada di Akhir Record"
    Else
        Adodc1.Recordset.MoveNext
End If
End Sub

Private Sub cprev_Click()
On Error Resume Next
If Adodc1.Recordset.BOF Then
    MsgBox "Anda Berada di Awal Record !!"
    Else
        Adodc1.Recordset.MovePrevious
End If
End Sub

Private Sub Form_Load()
Adodc1.Visible = False
Adodc1.ConnectionString = "Provider = Microsoft.Jet.OLEDB.4.0;Data source = " & App.Path & "\perpustakaan.mdb"
Adodc1.RecordSource = "select * from tblanggota"
Adodc1.Refresh

non
bersih
cmdadd.Enabled = True
cmdexit.Enabled = True
cfirst.Enabled = True
cprev.Enabled = True
cnext.Enabled = True
clast.Enabled = True
End Sub

Private Sub tcari_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Adodc1.RecordSource = "select * from tblanggota where kd_anggota='" & tcari & "'"
Adodc1.Refresh
    If Adodc1.Recordset.RecordCount > 0 Then
       tampil
    End If
End If
End Sub

Private Sub Timer1_Timer()
cmdexit.Caption = Right(cmdexit.Caption, Len(cmdexit.Caption) - 1) & Left(cmdexit.Caption, 1)
t.Caption = Right(t.Caption, Len(t.Caption) - 1) & Left(t.Caption, 1)
End Sub

Sub bersih()
Dim h As Control
For Each h In Me
If TypeOf h Is TextBox Then h.Text = ""
If TypeOf h Is OptionButton Then h.Value = False
Next h
End Sub

Sub aktif()
Dim h As Control
For Each h In Me
If TypeOf h Is TextBox Then h.Enabled = True
If TypeOf h Is OptionButton Then h.Enabled = True
If TypeOf h Is DTPicker Then h.Enabled = True
If TypeOf h Is CommandButton Then h.Enabled = True
Next h
End Sub

Sub non()
Dim h As Control
For Each h In Me
If TypeOf h Is TextBox Then h.Enabled = False
If TypeOf h Is OptionButton Then h.Enabled = False
If TypeOf h Is DTPicker Then h.Enabled = False
If TypeOf h Is CommandButton Then h.Enabled = False
Next h
End Sub

Private Sub Timer2_Timer()
t.BackColor = RGB(Rnd * 255, Rnd * 255, Rnd * 255)
End Sub

Form Transaksi "Perpustakaan Sederhana"



Listing nyaa nih yaaa: 




'==========================================================='
'||*****************************************************************||'
'||      Cuman Sekedar Program Amatir yg Dishare Sambil belajar                          ||'
'||               Created by : Haditya Syafei Sunarya                                                ||'
'||                    Email : siichampretbhendy@yahoo.co.id                                      ||'
'||                            siichampretbhendy@gmail.com                                           ||'
'||                            www.facebook.com/bangbhendz                                          ||'
'||                                                                                                                  ||'
'||                                                                                                                  ||'
'||               hadityasyafei.blogspot.com                                                             ||'
'||*****************************************************************||'
'==========================================================='

Private Sub Command1_Click()
aktif
bersih
nomat
Dt2.Value = (DT1.Value + 7)
End Sub

Private Sub Command2_Click()
On Error Resume Next
nonaktif
bersih
Adodc3.Recordset.Delete
Adodc3.Recordset.MoveNext
End Sub

Private Sub Command3_Click()
On Error Resume Next
If Adodc3.Recordset.RecordCount = 0 Then
MsgBox "Isi Data Dulu ..... !!"
DC1.SetFocus
End If

Adodc4.RecordSource = "Select * from pinjam"
Adodc4.Refresh
Adodc4.Recordset.AddNew
Adodc4.Recordset.Fields(0) = tno
Adodc4.Recordset.Fields(1) = DC1.Text
Adodc4.Recordset.Fields(2) = DT1.Value
Adodc4.Recordset.Update

If Adodc3.Recordset.RecordCount <> 0 Then
Adodc3.RecordSource = "select * from sementara"
Adodc3.Recordset.MoveFirst
Do While Not Adodc3.Recordset.EOF
Adodc5.RecordSource = "select * from detail_pinjam"
Adodc5.Refresh
With Adodc5.Recordset
.AddNew
.Fields(0) = Adodc3.Recordset.Fields(0)
.Fields(1) = Adodc3.Recordset.Fields(1)
.Fields(2) = Adodc3.Recordset.Fields(2)
.Fields(3) = Adodc3.Recordset.Fields(3)
.Fields(4) = Adodc3.Recordset.Fields(4)
.Fields(5) = Adodc3.Recordset.Fields(5)
.Update
End With
Adodc3.Recordset.Delete
Adodc3.Recordset.MoveNext
Loop

'Adodc1.RecordSource = "Select * from tblbuku"
'Adodc1.Refresh
'Adodc1.Recordset.Fields(5) = Adodc1.Recordset.Fields(5) - 1
'Adodc1.Recordset.Update

MsgBox "Data Tersimpan.......!!"
bersih
End If
End Sub

Private Sub Command4_Click()
With Adodc3.Recordset
.AddNew
!no_pinjam = tno.Text
!kd_buku = DC2.Text
!tgl_pinjam = DT1.Value
!tgl_kembali = Dt2.Value
!denda = "0"
!Status = "P"
.Update
End With
i = MsgBox("Tambahkan Buku Lain ??", vbYesNo, "Perpustakaan Bhendy")
If i = vbYes Then
DC2.SetFocus
Else
Command3.SetFocus
End If
End Sub

Private Sub DC1_Click(Area As Integer)
Adodc1.RecordSource = "select * from tblanggota where kd_anggota='" & DC1.Text & "'"
Adodc1.Refresh
If Adodc1.Recordset.RecordCount <> 0 Then
tnama.Text = Adodc1.Recordset.Fields(1)
End If
Adodc1.RecordSource = " select * from tblanggota"
Adodc1.Refresh
End Sub

Private Sub DC2_Click(Area As Integer)
Adodc2.RecordSource = "select * from tblbuku where kd_buku='" & DC2.Text & "'"
Adodc2.Refresh
If Adodc2.Recordset.RecordCount <> 0 Then
tpeng.Text = Adodc2.Recordset!pengarang
tjudul.Text = Adodc2.Recordset!judul_buku
End If
Adodc2.RecordSource = "select * from tblbuku"
Adodc2.Refresh
End Sub

Private Sub DT1_Change()
Dt2.Value = (DT1.Value + 7)
End Sub

Private Sub Form_Load()
conn Adodc1
Adodc1.RecordSource = "select * from tblanggota"
Adodc1.Refresh
conn Adodc2
Adodc2.RecordSource = "select * from tblbuku"
Adodc2.Refresh
conn Adodc3
Adodc3.RecordSource = "select * from sementara"
Adodc3.Refresh
conn Adodc4
Adodc4.RecordSource = "select * from pinjam"
Adodc4.Refresh
conn Adodc5
Adodc5.RecordSource = "select * from detail_pinjam"
Adodc5.Refresh
nonaktif
bersih
End Sub

Private Sub Image1_Click()
i = MsgBox("Anda Yakin Akan Keluar ?", vbYesNo + vbQuestion, "Perpustakaan Bhendy")
If i = vbYes Then
Unload Me
End If
End Sub

Sub bersih()
DC1.Text = ""
DC2.Text = ""
tnama.Text = ""
tpeng.Text = ""
tjudul.Text = ""
End Sub

Sub nonaktif()
tno.Enabled = False
DC1.Enabled = False
DC2.Enabled = False
tnama.Enabled = False
DT1.Enabled = False
Dt2.Enabled = False
tpeng.Enabled = False
tjudul.Enabled = False
Command2.Enabled = False
Command3.Enabled = False
Command4.Enabled = False
End Sub

Sub aktif()
DC1.Enabled = True
DC2.Enabled = True
tnama.Enabled = True
DT1.Enabled = True
tpeng.Enabled = True
tjudul.Enabled = True
Command2.Enabled = True
Command3.Enabled = True
Command4.Enabled = True
DT1.Value = Date
End Sub

Sub nomat()
Dim no, oto As String
Adodc5.RecordSource = "select * from pinjam"
Adodc5.Refresh
If Adodc5.Recordset.RecordCount = 0 Then
oto = Right(DT1.Value, 2) + Mid(DT1.Value, 4, 2) + Left(DT1.Value, 2) + "001"
Else
no = Right(Adodc5.Recordset!no_pinjam, 3) + 1
oto = Right(DT1.Value, 2) + Mid(DT1.Value, 4, 2) + Left(DT1.Value, 2) & Right("00" & no, 3)
End If
tno.Text = oto
End Sub