Pages

June 1, 2013

Membuat Aplikasi Persewaan VCD menggunakan VB 6.0 ( Tugas Siswa )



1.       Database :  Persewaan_VCD.mdb


Tabel  dengan Relasi sbb :


 
3.       Layout 
            








4.        






form Login

Dim kesempatan As Integer
Private Sub Command1_Click()
    kesempatan = kesempatan + 1
    If (LCase(Text1.Text) = "vcd_ok") And (kesempatan <= 3) Then
        Image1.Visible = True
        Text1.Enabled = False
        Command1.Enabled = False
        Menu.Show
    Else
        MsgBox "Passwordnya Salah !"
        If kesempatan < 3 Then
            Text1.Text = ""
            Text1.SetFocus
        Else
            MsgBox "Maaf, Anda tidak ada hak Akses untuk masuk program ini, silahkan hub. Programmer !"
            End
        End If
    End If
End Sub
Private Sub Timer1_Timer()
Label2.Caption = Format(Now, "HH:MM:SS")
End Sub


Form Anggota

Private Sub Awal()
Command1.Caption = "Tambah"
Command2.Caption = "Hapus"
Command3.Caption = "Keluar"
End Sub
Private Sub AktifTombol()
Command1.Enabled = True
Command2.Enabled = True
Command3.Enabled = True
End Sub
Private Sub Command1_Click()
Aktif
Bersih
Text1.SetFocus
Command1.Enabled = False
Command2.Caption = "Simpan"
Command3.Caption = "Batal"
End Sub

Private Sub Command2_Click()
Select Case Command2.Caption
Case "Hapus"
Adodc1.Recordset.Delete
DataGrid1.Refresh
Case "Simpan"
Adodc1.Recordset.AddNew
Adodc1.Recordset!No_Anggota = Text1.Text
Adodc1.Recordset!Nama_Anggota = Text2.Text
Adodc1.Recordset!Alm_Anggota = Text3.Text
Adodc1.Recordset!Telp_Anggota = Text4.Text

DataGrid1.Refresh
End Select
Bersih
Awal
AktifTombol
End Sub

Private Sub Command3_Click()
Select Case Command3.Caption
Case "Batal"
Bersih
Awal
AktifTombol
Case "Keluar"
Unload Me
End Select
End Sub
Private Sub Form_Load()
TidakAktif
Buka_DB
Adodc1.ConnectionString = Conn.ConnectionString
Adodc1.RecordSource = "Select*From anggota"
Adodc1.Refresh

Set DataGrid1.DataSource = Adodc1
End Sub

Private Sub Bersih()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
End Sub

Private Sub Aktif()
Text1.Enabled = True
Text2.Enabled = True
Text3.Enabled = True
Text4.Enabled = True
End Sub
Private Sub TidakAktif()
Text1.Enabled = False
Text2.Enabled = False
Text3.Enabled = False
Text4.Enabled = False
End Sub

Form Pinjam

Private Sub Command1_Click()
Dim frm As DetailPinjam
Set frm = New DetailPinjam
Set frm.Adodc2.Recordset = Adodc2.Recordset.Clone
frm.Text1.Text = Text1.Text
frm.Label6.Caption = Text3.Text
frm.Show vbModal
Adodc1.Recordset.Requery
Adodc2.Recordset.Requery
End Sub

Private Sub Command2_Click()
Aktif
Bersih
Text1.SetFocus
Text2.Text = Label9.Caption
Command3.Caption = "Batal"
End Sub

Private Sub Command3_Click()
Select Case Command3.Caption
Case "Batal"
TidakAktif
Bersih
Case "Keluar"
Unload Me
End Select
Command3.Caption = "Keluar"
End Sub

Private Sub Command4_Click()
Adodc2.Recordset.AddNew
Adodc2.Recordset("No_Pinjam") = Text1.Text
Adodc2.Recordset("Tgl_Pinjam") = Text2.Text
Adodc2.Recordset("Total_Pinjam") = Text3.Text
Adodc2.Recordset("No_Anggota") = Text4.Text
Adodc2.Recordset("Kode_petugas") = Text5.Text
Adodc2.Recordset("Total_Harga") = Text6.Text
Adodc2.Recordset("DiBayar") = Text7.Text
Adodc2.Recordset("Kembali") = Text8.Text
Command3.Caption = "Keluar"
End Sub

Private Sub Command5_Click()
Bersih
TidakAktif
End Sub

Private Sub DataGrid2_RowColChange(LastRow As Variant, ByVal LastCol As Integer)
If (Not Adodc2.Recordset.BOF And Not Adodc2.Recordset.EOF) Then
FilterDetPinjam Adodc2.Recordset("No_Pinjam")
End If
End Sub

Private Sub Form_Load()
Bersih
TidakAktif
Buka_DB
Adodc1.ConnectionString = Conn.ConnectionString
Adodc1.RecordSource = "Select*From DetailPinjam"
Adodc1.Refresh
Set DataGrid1.DataSource = Adodc1

Adodc2.ConnectionString = Conn.ConnectionString
Adodc2.RecordSource = "Select*from Pinjam"
Adodc2.Refresh
Set DataGrid2.DataSource = Adodc2

Adodc3.ConnectionString = Conn.ConnectionString
Adodc3.RecordSource = "Select*from Anggota"
Adodc3.Refresh
Set DataGrid3.DataSource = Adodc3

Adodc4.ConnectionString = Conn.ConnectionString
Adodc4.RecordSource = "Select*from Petugas"
Adodc4.Refresh
Set DataGrid4.DataSource = Adodc4
Text9.Enabled = False
Text10.Enabled = False
End Sub

Private Sub Bersih()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
Text8.Text = ""
Text9.Text = ""
Text10.Text = ""
End Sub

Private Sub Aktif()
Text1.Enabled = True
Text2.Enabled = True
Text3.Enabled = True
Text4.Enabled = True
Text5.Enabled = True
Text6.Enabled = True
Text7.Enabled = True
Text8.Enabled = True
End Sub
Private Sub TidakAktif()
Text1.Enabled = False
Text2.Enabled = False
Text3.Enabled = False
Text4.Enabled = False
Text5.Enabled = False
Text6.Enabled = False
Text7.Enabled = False
Text8.Enabled = False
End Sub

Private Sub Text1_LostFocus()
Adodc2.Recordset.MoveFirst
Adodc2.Recordset.Find "No_Pinjam='" & Text1.Text & " ' "
If (Not Adodc2.Recordset.BOF And Not Adodc2.Recordset.EOF) Then
MsgBox "Nomor Pinjam Sudah ada"
Text1.Text = ""
Text1.SetFocus
End If
End Sub

Private Sub FilterDetPinjam(no As String)
Adodc1.Recordset.Filter = "No_Pinjam='" & no & "'"
End Sub



Private Sub Text4_LostFocus()
Adodc3.Recordset.MoveFirst
Adodc3.Recordset.Find "No_Anggota='" & Text4.Text & "'"
If (Adodc3.Recordset.BOF Or Adodc3.Recordset.EOF) Then
MsgBox "ID Anggota tidak di Temukan"
Text4.Text = ""
Text4.SetFocus
Else
Text9.Text = Adodc3.Recordset("Nama_Anggota")
End If
End Sub

Private Sub Text5_LostFocus()
Adodc4.Recordset.MoveFirst
Adodc4.Recordset.Find "Kode_Petugas='" & Text5.Text & "'"
If (Adodc4.Recordset.BOF Or Adodc4.Recordset.EOF) Then
MsgBox "ID Petugas tidak di Temukan"
Text5.Text = ""
Text5.SetFocus
Else
Text10.Text = Adodc4.Recordset("Nama_Petugas")
End If
End Sub

Private Sub Text6_Change()
Text6.Enabled = False
End Sub

Private Sub Text7_Change()
Text8.Text = Val(Text7.Text) - Val(Text6.Text)
End Sub

Private Sub Text8_Change()
Text8.Enabled = False
End Sub

Private Sub Timer1_Timer()
Label9.Caption = Format(Now, "MM/DD/YYYY")
Label10.Caption = Format(Now, "HH:MM:SS")
End Sub

Form detail  Pinjam

Option Explicit
Public TanggalPinjam As String
Public NomerFilm As String

Private Sub Command1_Click()
Bersih
End Sub

Private Sub Command2_Click()
Adodc1.Recordset.Delete
End Sub

Private Sub Command3_Click()
Adodc1.Recordset.AddNew
Adodc1.Recordset("No_Pinjam") = Text1.Text
Adodc1.Recordset("No_Film") = Text2.Text
Adodc1.Recordset("Jumlah_Film") = Text3.Text
Adodc1.Recordset.Update

Adodc1.Recordset.Requery
Adodc1.Recordset.Filter = "No_Pinjam='" & Text1.Text & "'"
Bersih
Adodc2.Recordset.MoveFirst
End Sub


Private Sub Command6_Click()
Unload Me
End Sub

Private Sub GridText()
Text1.Text = Adodc1.Recordset("No_Pinjam")
Text3.Text = Adodc1.Recordset("Jumlah_Film")
End Sub

Private Sub DataGrid1_RowColChange(LastRow As Variant, ByVal LastCol As Integer)
If (Not Adodc1.Recordset.BOF And Not Adodc1.Recordset.EOF) Then
GridText
End If
End Sub

Private Sub Form_Load()
Buka_DB
Adodc1.ConnectionString = Conn.ConnectionString
Adodc1.RecordSource = "Select*From DetailPinjam"
Adodc1.Refresh
Set DataGrid1.DataSource = Adodc1

Adodc2.ConnectionString = Conn.ConnectionString
Adodc2.RecordSource = "Select*From Pinjam"
Adodc2.Refresh
Set DataGrid2.DataSource = Adodc2

Adodc3.ConnectionString = Conn.ConnectionString
Adodc3.RecordSource = "Select*From Film"
Adodc3.Refresh
Set DataGrid3.DataSource = Adodc3
ImageNotActived
Text4.Enabled = False
End Sub
Private Sub Bersih()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
End Sub


Private Sub Text2_KeyPress(KeyAscii As Integer)
KeyAscii = Asc(UCase(Chr(KeyAscii)))
If KeyAscii = 13 Then
Adodc3.Recordset.MoveFirst
Adodc3.Recordset.Find "No_Film='" & Text2.Text & "'"
If (Adodc3.Recordset.BOF Or Adodc3.Recordset.EOF) Then
 MsgBox "No Film Tidak di Temukan"
 Text2.Text = ""
 Text2.SetFocus
Else
Text4.Text = Adodc3.Recordset("Judul")
Label7.Caption = Adodc3.Recordset("Stok")
Label11.Caption = Adodc3.Recordset("Tarif")
End If
End If
Text3.Text = Val(Label7.Caption) - Val(Label6.Caption)
Label12.Caption = Val(Label11.Caption) * Val(Label6.Caption)

Pinjam.Text6.Text = Label12.Caption
End Sub

Private Sub Text4_Change()
Select Case Text4.Text
Case "Jhon Carter"
Image1.Visible = True
Image2.Visible = False
Image3.Visible = False
Image4.Visible = False
Image5.Visible = False
Image6.Visible = False
Image7.Visible = False
Image8.Visible = False
Image9.Visible = False
Image10.Visible = False
Image11.Visible = False
Case "Iron Man I"
Image1.Visible = False
Image2.Visible = False
Image3.Visible = False
Image4.Visible = True
Image5.Visible = False
Image6.Visible = False
Image7.Visible = False
Image8.Visible = False
Image9.Visible = False
Image10.Visible = False
Image11.Visible = False
Case "Iron Man II"
Image1.Visible = False
Image2.Visible = True
Image3.Visible = False
Image4.Visible = False
Image5.Visible = False
Image6.Visible = False
Image7.Visible = False
Image8.Visible = False
Image9.Visible = False
Image10.Visible = False
Image11.Visible = False
Case "Iron Man III"
Image1.Visible = False
Image2.Visible = False
Image3.Visible = True
Image4.Visible = False
Image5.Visible = False
Image6.Visible = False
Image7.Visible = False
Image8.Visible = False
Image9.Visible = False
Image10.Visible = False
Image11.Visible = False
Case "300"
Image1.Visible = False
Image2.Visible = False
Image3.Visible = False
Image4.Visible = False
Image5.Visible = True
Image6.Visible = False
Image7.Visible = False
Image8.Visible = False
Image9.Visible = False
Image10.Visible = False
Image11.Visible = False
Case "Eyeshield 21"
Image1.Visible = False
Image2.Visible = False
Image3.Visible = False
Image4.Visible = False
Image5.Visible = False
Image6.Visible = True
Image7.Visible = False
Image8.Visible = False
Image9.Visible = False
Image10.Visible = False
Image11.Visible = False
Case "Bleach"
Image1.Visible = False
Image2.Visible = False
Image3.Visible = False
Image4.Visible = False
Image5.Visible = False
Image6.Visible = False
Image7.Visible = True
Image8.Visible = False
Image9.Visible = False
Image10.Visible = False
Image11.Visible = False
Case "Naruto:Road To Ninja"
Image1.Visible = False
Image2.Visible = False
Image3.Visible = False
Image4.Visible = False
Image5.Visible = False
Image6.Visible = False
Image7.Visible = False
Image8.Visible = True
Image9.Visible = False
Image10.Visible = False
Image11.Visible = False
Case "Prince Of Persia"
Image1.Visible = False
Image2.Visible = False
Image3.Visible = False
Image4.Visible = False
Image5.Visible = False
Image6.Visible = False
Image7.Visible = False
Image8.Visible = False
Image9.Visible = True
Image10.Visible = False
Image11.Visible = False
Case "Pirates Of Carribean"
Image1.Visible = False
Image2.Visible = False
Image3.Visible = False
Image4.Visible = False
Image5.Visible = False
Image6.Visible = False
Image7.Visible = False
Image8.Visible = False
Image9.Visible = False
Image10.Visible = True
Image11.Visible = False
Case "Fast and Furios 6"
Image1.Visible = False
Image2.Visible = False
Image3.Visible = False
Image4.Visible = False
Image5.Visible = False
Image6.Visible = False
Image7.Visible = False
Image8.Visible = False
Image9.Visible = False
Image10.Visible = False
Image11.Visible = True
End Select
End Sub

Private Sub ImageNotActived()
Image1.Visible = False
Image2.Visible = False
Image3.Visible = False
Image4.Visible = False
Image5.Visible = False
Image6.Visible = False
Image7.Visible = False
Image8.Visible = False
Image9.Visible = False
Image10.Visible = False
Image11.Visible = False
End Sub


Form KEmbali

Private Sub Command3_Click()
Unload Me
End Sub

Private Sub Command4_Click()
Adodc2.Recordset.AddNew
Adodc2.Recordset("No_Kembali") = Text1.Text
Adodc2.Recordset("Tgl_Kembali") = Text2.Text
Adodc2.Recordset("Total_Kembali") = Text3.Text
Adodc2.Recordset("No_Anggota") = Text4.Text
Adodc2.Recordset("Kode_petugas") = Text5.Text
Adodc2.Recordset("Denda") = Text6.Text
Adodc2.Recordset("DiBayar") = Text7.Text
Adodc2.Recordset("Kembali") = Text8.Text
End Sub

Private Sub Form_Load()
Bersih
TidakAktif
Buka_DB
Adodc1.ConnectionString = Conn.ConnectionString
Adodc1.RecordSource = "Select*From DetailKembali"
Adodc1.Refresh
Set DataGrid1.DataSource = Adodc1

Adodc2.ConnectionString = Conn.ConnectionString
Adodc2.RecordSource = "Select*from Kembali"
Adodc1.Refresh
Set DataGrid2.DataSource = Adodc2

Adodc3.ConnectionString = Conn.ConnectionString
Adodc3.RecordSource = "Select*from Anggota"
Adodc3.Refresh
Set DataGrid3.DataSource = Adodc3

Adodc4.ConnectionString = Conn.ConnectionString
Adodc4.RecordSource = "Select*from Petugas"
Adodc4.Refresh
Set DataGrid4.DataSource = Adodc4
Text9.Enabled = False
Text10.Enabled = False
End Sub
Private Sub Command1_Click()
Dim frm As Form1
Set frm = New Form1
Set frm.Adodc2.Recordset = Adodc2.Recordset.Clone
frm.Text1.Text = Text1.Text
frm.Label7.Caption = Text3.Text
frm.Show vbModal
Adodc1.Recordset.Requery
Adodc2.Recordset.Requery
End Sub

Private Sub Command2_Click()
Aktif
Bersih
Text1.SetFocus
Text2.Text = Label9.Caption
End Sub

Private Sub DataGrid2_RowColChange(LastRow As Variant, ByVal LastCol As Integer)
If (Not Adodc2.Recordset.BOF And Not Adodc2.Recordset.EOF) Then
FilterDetKembali Adodc2.Recordset("No_Kembali")
End If
End Sub
Private Sub Bersih()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
Text8.Text = ""
Text9.Text = ""
Text10.Text = ""
End Sub

Private Sub Aktif()
Text1.Enabled = True
Text2.Enabled = True
Text3.Enabled = True
Text4.Enabled = True
Text5.Enabled = True
Text7.Enabled = True
End Sub
Private Sub TidakAktif()
Text1.Enabled = False
Text2.Enabled = False
Text3.Enabled = False
Text4.Enabled = False
Text5.Enabled = False
Text7.Enabled = False
End Sub

Private Sub Text1_LostFocus()
Adodc2.Recordset.MoveFirst
Adodc2.Recordset.Find "No_Kembali='" & Text1.Text & " ' "
If (Not Adodc2.Recordset.BOF And Not Adodc2.Recordset.EOF) Then
MsgBox "Nomor Pengembalian tidak di Temukan"
Text1.Text = ""
Text1.SetFocus
End If
End Sub

Private Sub FilterDetKembali(no As String)
Adodc1.Recordset.Filter = "No_Kembali='" & no & "'"
End Sub

Private Sub Text4_LostFocus()
Adodc3.Recordset.MoveFirst
Adodc3.Recordset.Find "No_Anggota='" & Text4.Text & "'"
If (Adodc3.Recordset.BOF Or Adodc3.Recordset.EOF) Then
MsgBox "Kode Anggota tidak di Temukan"
Text4.Text = ""
Text4.SetFocus
Else
Text9.Text = Adodc3.Recordset("Nama_Anggota")
End If
End Sub

Private Sub Text5_LostFocus()
Adodc4.Recordset.MoveFirst
Adodc4.Recordset.Find "Kode_Petugas='" & Text5.Text & "'"
If (Adodc4.Recordset.BOF Or Adodc4.Recordset.EOF) Then
MsgBox "Kode Petugas tidak di Temukan"
Text5.Text = ""
Text5.SetFocus
Else
Text10.Text = Adodc4.Recordset("Nama_Petugas")
End If
End Sub

Private Sub Text6_Change()
Text6.Enabled = False
End Sub

Private Sub Text7_Change()
Text8.Text = Val(Text7.Text) - Val(Text6.Text)
End Sub

Private Sub Text8_Change()
Text8.Enabled = False
End Sub

Private Sub Timer1_Timer()
Label9.Caption = Format(Now, "DD/MM/YYYY")
End Sub

form Login

Dim kesempatan As Integer
Private Sub Command1_Click()
    kesempatan = kesempatan + 1
    If (LCase(Text1.Text) = "vcd_ok") And (kesempatan <= 3) Then
        Image1.Visible = True
        Text1.Enabled = False
        Command1.Enabled = False
        Menu.Show
    Else
        MsgBox "Passwordnya Salah !"
        If kesempatan < 3 Then
            Text1.Text = ""
            Text1.SetFocus
        Else
            MsgBox "Maaf, Anda tidak ada hak Akses untuk masuk program ini, silahkan hub. Programmer !"
            End
        End If
    End If
End Sub
Private Sub Timer1_Timer()
Label2.Caption = Format(Now, "HH:MM:SS")
End Sub


Form Anggota

Private Sub Awal()
Command1.Caption = "Tambah"
Command2.Caption = "Hapus"
Command3.Caption = "Keluar"
End Sub
Private Sub AktifTombol()
Command1.Enabled = True
Command2.Enabled = True
Command3.Enabled = True
End Sub
Private Sub Command1_Click()
Aktif
Bersih
Text1.SetFocus
Command1.Enabled = False
Command2.Caption = "Simpan"
Command3.Caption = "Batal"
End Sub

Private Sub Command2_Click()
Select Case Command2.Caption
Case "Hapus"
Adodc1.Recordset.Delete
DataGrid1.Refresh
Case "Simpan"
Adodc1.Recordset.AddNew
Adodc1.Recordset!No_Anggota = Text1.Text
Adodc1.Recordset!Nama_Anggota = Text2.Text
Adodc1.Recordset!Alm_Anggota = Text3.Text
Adodc1.Recordset!Telp_Anggota = Text4.Text

DataGrid1.Refresh
End Select
Bersih
Awal
AktifTombol
End Sub

Private Sub Command3_Click()
Select Case Command3.Caption
Case "Batal"
Bersih
Awal
AktifTombol
Case "Keluar"
Unload Me
End Select
End Sub
Private Sub Form_Load()
TidakAktif
Buka_DB
Adodc1.ConnectionString = Conn.ConnectionString
Adodc1.RecordSource = "Select*From anggota"
Adodc1.Refresh

Set DataGrid1.DataSource = Adodc1
End Sub

Private Sub Bersih()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
End Sub

Private Sub Aktif()
Text1.Enabled = True
Text2.Enabled = True
Text3.Enabled = True
Text4.Enabled = True
End Sub
Private Sub TidakAktif()
Text1.Enabled = False
Text2.Enabled = False
Text3.Enabled = False
Text4.Enabled = False
End Sub

Form Pinjam

Private Sub Command1_Click()
Dim frm As DetailPinjam
Set frm = New DetailPinjam
Set frm.Adodc2.Recordset = Adodc2.Recordset.Clone
frm.Text1.Text = Text1.Text
frm.Label6.Caption = Text3.Text
frm.Show vbModal
Adodc1.Recordset.Requery
Adodc2.Recordset.Requery
End Sub

Private Sub Command2_Click()
Aktif
Bersih
Text1.SetFocus
Text2.Text = Label9.Caption
Command3.Caption = "Batal"
End Sub

Private Sub Command3_Click()
Select Case Command3.Caption
Case "Batal"
TidakAktif
Bersih
Case "Keluar"
Unload Me
End Select
Command3.Caption = "Keluar"
End Sub

Private Sub Command4_Click()
Adodc2.Recordset.AddNew
Adodc2.Recordset("No_Pinjam") = Text1.Text
Adodc2.Recordset("Tgl_Pinjam") = Text2.Text
Adodc2.Recordset("Total_Pinjam") = Text3.Text
Adodc2.Recordset("No_Anggota") = Text4.Text
Adodc2.Recordset("Kode_petugas") = Text5.Text
Adodc2.Recordset("Total_Harga") = Text6.Text
Adodc2.Recordset("DiBayar") = Text7.Text
Adodc2.Recordset("Kembali") = Text8.Text
Command3.Caption = "Keluar"
End Sub

Private Sub Command5_Click()
Bersih
TidakAktif
End Sub

Private Sub DataGrid2_RowColChange(LastRow As Variant, ByVal LastCol As Integer)
If (Not Adodc2.Recordset.BOF And Not Adodc2.Recordset.EOF) Then
FilterDetPinjam Adodc2.Recordset("No_Pinjam")
End If
End Sub

Private Sub Form_Load()
Bersih
TidakAktif
Buka_DB
Adodc1.ConnectionString = Conn.ConnectionString
Adodc1.RecordSource = "Select*From DetailPinjam"
Adodc1.Refresh
Set DataGrid1.DataSource = Adodc1

Adodc2.ConnectionString = Conn.ConnectionString
Adodc2.RecordSource = "Select*from Pinjam"
Adodc2.Refresh
Set DataGrid2.DataSource = Adodc2

Adodc3.ConnectionString = Conn.ConnectionString
Adodc3.RecordSource = "Select*from Anggota"
Adodc3.Refresh
Set DataGrid3.DataSource = Adodc3

Adodc4.ConnectionString = Conn.ConnectionString
Adodc4.RecordSource = "Select*from Petugas"
Adodc4.Refresh
Set DataGrid4.DataSource = Adodc4
Text9.Enabled = False
Text10.Enabled = False
End Sub

Private Sub Bersih()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
Text8.Text = ""
Text9.Text = ""
Text10.Text = ""
End Sub

Private Sub Aktif()
Text1.Enabled = True
Text2.Enabled = True
Text3.Enabled = True
Text4.Enabled = True
Text5.Enabled = True
Text6.Enabled = True
Text7.Enabled = True
Text8.Enabled = True
End Sub
Private Sub TidakAktif()
Text1.Enabled = False
Text2.Enabled = False
Text3.Enabled = False
Text4.Enabled = False
Text5.Enabled = False
Text6.Enabled = False
Text7.Enabled = False
Text8.Enabled = False
End Sub

Private Sub Text1_LostFocus()
Adodc2.Recordset.MoveFirst
Adodc2.Recordset.Find "No_Pinjam='" & Text1.Text & " ' "
If (Not Adodc2.Recordset.BOF And Not Adodc2.Recordset.EOF) Then
MsgBox "Nomor Pinjam Sudah ada"
Text1.Text = ""
Text1.SetFocus
End If
End Sub

Private Sub FilterDetPinjam(no As String)
Adodc1.Recordset.Filter = "No_Pinjam='" & no & "'"
End Sub



Private Sub Text4_LostFocus()
Adodc3.Recordset.MoveFirst
Adodc3.Recordset.Find "No_Anggota='" & Text4.Text & "'"
If (Adodc3.Recordset.BOF Or Adodc3.Recordset.EOF) Then
MsgBox "ID Anggota tidak di Temukan"
Text4.Text = ""
Text4.SetFocus
Else
Text9.Text = Adodc3.Recordset("Nama_Anggota")
End If
End Sub

Private Sub Text5_LostFocus()
Adodc4.Recordset.MoveFirst
Adodc4.Recordset.Find "Kode_Petugas='" & Text5.Text & "'"
If (Adodc4.Recordset.BOF Or Adodc4.Recordset.EOF) Then
MsgBox "ID Petugas tidak di Temukan"
Text5.Text = ""
Text5.SetFocus
Else
Text10.Text = Adodc4.Recordset("Nama_Petugas")
End If
End Sub

Private Sub Text6_Change()
Text6.Enabled = False
End Sub

Private Sub Text7_Change()
Text8.Text = Val(Text7.Text) - Val(Text6.Text)
End Sub

Private Sub Text8_Change()
Text8.Enabled = False
End Sub

Private Sub Timer1_Timer()
Label9.Caption = Format(Now, "MM/DD/YYYY")
Label10.Caption = Format(Now, "HH:MM:SS")
End Sub

Form detail  Pinjam

Option Explicit
Public TanggalPinjam As String
Public NomerFilm As String

Private Sub Command1_Click()
Bersih
End Sub

Private Sub Command2_Click()
Adodc1.Recordset.Delete
End Sub

Private Sub Command3_Click()
Adodc1.Recordset.AddNew
Adodc1.Recordset("No_Pinjam") = Text1.Text
Adodc1.Recordset("No_Film") = Text2.Text
Adodc1.Recordset("Jumlah_Film") = Text3.Text
Adodc1.Recordset.Update

Adodc1.Recordset.Requery
Adodc1.Recordset.Filter = "No_Pinjam='" & Text1.Text & "'"
Bersih
Adodc2.Recordset.MoveFirst
End Sub


Private Sub Command6_Click()
Unload Me
End Sub

Private Sub GridText()
Text1.Text = Adodc1.Recordset("No_Pinjam")
Text3.Text = Adodc1.Recordset("Jumlah_Film")
End Sub

Private Sub DataGrid1_RowColChange(LastRow As Variant, ByVal LastCol As Integer)
If (Not Adodc1.Recordset.BOF And Not Adodc1.Recordset.EOF) Then
GridText
End If
End Sub

Private Sub Form_Load()
Buka_DB
Adodc1.ConnectionString = Conn.ConnectionString
Adodc1.RecordSource = "Select*From DetailPinjam"
Adodc1.Refresh
Set DataGrid1.DataSource = Adodc1

Adodc2.ConnectionString = Conn.ConnectionString
Adodc2.RecordSource = "Select*From Pinjam"
Adodc2.Refresh
Set DataGrid2.DataSource = Adodc2

Adodc3.ConnectionString = Conn.ConnectionString
Adodc3.RecordSource = "Select*From Film"
Adodc3.Refresh
Set DataGrid3.DataSource = Adodc3
ImageNotActived
Text4.Enabled = False
End Sub
Private Sub Bersih()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
End Sub


Private Sub Text2_KeyPress(KeyAscii As Integer)
KeyAscii = Asc(UCase(Chr(KeyAscii)))
If KeyAscii = 13 Then
Adodc3.Recordset.MoveFirst
Adodc3.Recordset.Find "No_Film='" & Text2.Text & "'"
If (Adodc3.Recordset.BOF Or Adodc3.Recordset.EOF) Then
 MsgBox "No Film Tidak di Temukan"
 Text2.Text = ""
 Text2.SetFocus
Else
Text4.Text = Adodc3.Recordset("Judul")
Label7.Caption = Adodc3.Recordset("Stok")
Label11.Caption = Adodc3.Recordset("Tarif")
End If
End If
Text3.Text = Val(Label7.Caption) - Val(Label6.Caption)
Label12.Caption = Val(Label11.Caption) * Val(Label6.Caption)

Pinjam.Text6.Text = Label12.Caption
End Sub

Private Sub Text4_Change()
Select Case Text4.Text
Case "Jhon Carter"
Image1.Visible = True
Image2.Visible = False
Image3.Visible = False
Image4.Visible = False
Image5.Visible = False
Image6.Visible = False
Image7.Visible = False
Image8.Visible = False
Image9.Visible = False
Image10.Visible = False
Image11.Visible = False
Case "Iron Man I"
Image1.Visible = False
Image2.Visible = False
Image3.Visible = False
Image4.Visible = True
Image5.Visible = False
Image6.Visible = False
Image7.Visible = False
Image8.Visible = False
Image9.Visible = False
Image10.Visible = False
Image11.Visible = False
Case "Iron Man II"
Image1.Visible = False
Image2.Visible = True
Image3.Visible = False
Image4.Visible = False
Image5.Visible = False
Image6.Visible = False
Image7.Visible = False
Image8.Visible = False
Image9.Visible = False
Image10.Visible = False
Image11.Visible = False
Case "Iron Man III"
Image1.Visible = False
Image2.Visible = False
Image3.Visible = True
Image4.Visible = False
Image5.Visible = False
Image6.Visible = False
Image7.Visible = False
Image8.Visible = False
Image9.Visible = False
Image10.Visible = False
Image11.Visible = False
Case "300"
Image1.Visible = False
Image2.Visible = False
Image3.Visible = False
Image4.Visible = False
Image5.Visible = True
Image6.Visible = False
Image7.Visible = False
Image8.Visible = False
Image9.Visible = False
Image10.Visible = False
Image11.Visible = False
Case "Eyeshield 21"
Image1.Visible = False
Image2.Visible = False
Image3.Visible = False
Image4.Visible = False
Image5.Visible = False
Image6.Visible = True
Image7.Visible = False
Image8.Visible = False
Image9.Visible = False
Image10.Visible = False
Image11.Visible = False
Case "Bleach"
Image1.Visible = False
Image2.Visible = False
Image3.Visible = False
Image4.Visible = False
Image5.Visible = False
Image6.Visible = False
Image7.Visible = True
Image8.Visible = False
Image9.Visible = False
Image10.Visible = False
Image11.Visible = False
Case "Naruto:Road To Ninja"
Image1.Visible = False
Image2.Visible = False
Image3.Visible = False
Image4.Visible = False
Image5.Visible = False
Image6.Visible = False
Image7.Visible = False
Image8.Visible = True
Image9.Visible = False
Image10.Visible = False
Image11.Visible = False
Case "Prince Of Persia"
Image1.Visible = False
Image2.Visible = False
Image3.Visible = False
Image4.Visible = False
Image5.Visible = False
Image6.Visible = False
Image7.Visible = False
Image8.Visible = False
Image9.Visible = True
Image10.Visible = False
Image11.Visible = False
Case "Pirates Of Carribean"
Image1.Visible = False
Image2.Visible = False
Image3.Visible = False
Image4.Visible = False
Image5.Visible = False
Image6.Visible = False
Image7.Visible = False
Image8.Visible = False
Image9.Visible = False
Image10.Visible = True
Image11.Visible = False
Case "Fast and Furios 6"
Image1.Visible = False
Image2.Visible = False
Image3.Visible = False
Image4.Visible = False
Image5.Visible = False
Image6.Visible = False
Image7.Visible = False
Image8.Visible = False
Image9.Visible = False
Image10.Visible = False
Image11.Visible = True
End Select
End Sub

Private Sub ImageNotActived()
Image1.Visible = False
Image2.Visible = False
Image3.Visible = False
Image4.Visible = False
Image5.Visible = False
Image6.Visible = False
Image7.Visible = False
Image8.Visible = False
Image9.Visible = False
Image10.Visible = False
Image11.Visible = False
End Sub


Form KEmbali

Private Sub Command3_Click()
Unload Me
End Sub

Private Sub Command4_Click()
Adodc2.Recordset.AddNew
Adodc2.Recordset("No_Kembali") = Text1.Text
Adodc2.Recordset("Tgl_Kembali") = Text2.Text
Adodc2.Recordset("Total_Kembali") = Text3.Text
Adodc2.Recordset("No_Anggota") = Text4.Text
Adodc2.Recordset("Kode_petugas") = Text5.Text
Adodc2.Recordset("Denda") = Text6.Text
Adodc2.Recordset("DiBayar") = Text7.Text
Adodc2.Recordset("Kembali") = Text8.Text
End Sub

Private Sub Form_Load()
Bersih
TidakAktif
Buka_DB
Adodc1.ConnectionString = Conn.ConnectionString
Adodc1.RecordSource = "Select*From DetailKembali"
Adodc1.Refresh
Set DataGrid1.DataSource = Adodc1

Adodc2.ConnectionString = Conn.ConnectionString
Adodc2.RecordSource = "Select*from Kembali"
Adodc1.Refresh
Set DataGrid2.DataSource = Adodc2

Adodc3.ConnectionString = Conn.ConnectionString
Adodc3.RecordSource = "Select*from Anggota"
Adodc3.Refresh
Set DataGrid3.DataSource = Adodc3

Adodc4.ConnectionString = Conn.ConnectionString
Adodc4.RecordSource = "Select*from Petugas"
Adodc4.Refresh
Set DataGrid4.DataSource = Adodc4
Text9.Enabled = False
Text10.Enabled = False
End Sub
Private Sub Command1_Click()
Dim frm As Form1
Set frm = New Form1
Set frm.Adodc2.Recordset = Adodc2.Recordset.Clone
frm.Text1.Text = Text1.Text
frm.Label7.Caption = Text3.Text
frm.Show vbModal
Adodc1.Recordset.Requery
Adodc2.Recordset.Requery
End Sub

Private Sub Command2_Click()
Aktif
Bersih
Text1.SetFocus
Text2.Text = Label9.Caption
End Sub

Private Sub DataGrid2_RowColChange(LastRow As Variant, ByVal LastCol As Integer)
If (Not Adodc2.Recordset.BOF And Not Adodc2.Recordset.EOF) Then
FilterDetKembali Adodc2.Recordset("No_Kembali")
End If
End Sub
Private Sub Bersih()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
Text8.Text = ""
Text9.Text = ""
Text10.Text = ""
End Sub

Private Sub Aktif()
Text1.Enabled = True
Text2.Enabled = True
Text3.Enabled = True
Text4.Enabled = True
Text5.Enabled = True
Text7.Enabled = True
End Sub
Private Sub TidakAktif()
Text1.Enabled = False
Text2.Enabled = False
Text3.Enabled = False
Text4.Enabled = False
Text5.Enabled = False
Text7.Enabled = False
End Sub

Private Sub Text1_LostFocus()
Adodc2.Recordset.MoveFirst
Adodc2.Recordset.Find "No_Kembali='" & Text1.Text & " ' "
If (Not Adodc2.Recordset.BOF And Not Adodc2.Recordset.EOF) Then
MsgBox "Nomor Pengembalian tidak di Temukan"
Text1.Text = ""
Text1.SetFocus
End If
End Sub

Private Sub FilterDetKembali(no As String)
Adodc1.Recordset.Filter = "No_Kembali='" & no & "'"
End Sub

Private Sub Text4_LostFocus()
Adodc3.Recordset.MoveFirst
Adodc3.Recordset.Find "No_Anggota='" & Text4.Text & "'"
If (Adodc3.Recordset.BOF Or Adodc3.Recordset.EOF) Then
MsgBox "Kode Anggota tidak di Temukan"
Text4.Text = ""
Text4.SetFocus
Else
Text9.Text = Adodc3.Recordset("Nama_Anggota")
End If
End Sub

Private Sub Text5_LostFocus()
Adodc4.Recordset.MoveFirst
Adodc4.Recordset.Find "Kode_Petugas='" & Text5.Text & "'"
If (Adodc4.Recordset.BOF Or Adodc4.Recordset.EOF) Then
MsgBox "Kode Petugas tidak di Temukan"
Text5.Text = ""
Text5.SetFocus
Else
Text10.Text = Adodc4.Recordset("Nama_Petugas")
End If
End Sub

Private Sub Text6_Change()
Text6.Enabled = False
End Sub

Private Sub Text7_Change()
Text8.Text = Val(Text7.Text) - Val(Text6.Text)
End Sub

Private Sub Text8_Change()
Text8.Enabled = False
End Sub

Private Sub Timer1_Timer()
Label9.Caption = Format(Now, "DD/MM/YYYY")
End Sub

























1 comment:

Daftar Artikel