Jumat, 07 Januari 2011

MEMBUAT LAPORAN

A. Membuat Data Environment

1. Buka project baru
2. Klik menu Project
3. Pilih More Activex Designer
4. Pilih Data Environment
5. Klik kanan Connection
6. Properties..
7. Pilih Microsoft Jet 3.51 OLE DB Provider (jika database dibuat dengan   
    Visdata)
8. Pilih Microsoft Jet 4.0 OLE DB Provider (jika database dibuat dengan    
     access versi 2000 keatas)
9. Klik Next
10. Klik button Select or enter database name :
11. Pilih database (di direktori tertentu)
12. Open
13. Klik Test Connenction
14. Klik OK
15. Klik OK
16. Klik kanan Connection
17. Pilih Add Command
18. Klik kanan Command1
19. Klik Properties..

20. Pada Combo Database Object pilih table
22. Klik Apply
23. OK
24. Hingga tampilannya menjadi seperti gambar di bawah ini



B. Membuat Data Report

1. Klik menu project
2. Add Data Report
3. Klik menu Windows
4. Klik Cascade


5. Geser beberapa window hingga tampil dua window berikut
6. Drag Command1 ke dalam window DataReport
7. Lalu ubah posisinya seperti gambar berikut
 8. Klik button DataSource di window properti
9. Pilih DataEnvironment1
10. Klik button DataMember di window properti
11. Pilih Command1
12. Buatlah sebuah Command Button dalam form
13. Double Click Command
14. Tulis kode program berikut form menu dan tombol cektak laporan


Private Sub Command1_Click()
DataReportPembayaran.Show
End Sub
15. Jalankan program dan lihat hasilnya
16. Lakukan modifikasi sesuai kebutuhan
17. Simpan file

FORM ABOUT


Tabel TOOL :


Kode Programnya :
Option Explicit

Private Declare Function ShellExecute Lib _
   "shell32.dll" Alias "ShellExecuteA" _
   (ByVal hwnd As Long, _
   ByVal lpOperation As String, _
   ByVal lpFile As String, _
   ByVal lpParameters As String, _
   ByVal lpDirectory As String, _
   ByVal nShowCmd As Long) As Long

Private Const SW_SHOWNORMAL = 1
Dim posTengah As Integer


Sub Keluar()
    posTengah = Me.Top
    Me.Top = Me.Top + 10
    Me.Timer2.Interval = 50
End Sub


Private Sub Form_Load()
Me.Top = Me.Height * -1
    Me.Left = (Screen.Width - Me.Width) / 1
    posTengah = (Screen.Height - Me.Height) / 2
    Me.Timer1.Interval = 50
End Sub


Private Sub Image1_Click()
Keluar
End Sub


Private Sub Label3_Click()
ShellExecute Me.hwnd, _
   vbNullString, _
   "http://edukasi-informatika.blogspot.com", _
   vbNullString, _
   "c:\", _
   SW_SHOWNORMAL
Keluar
End Sub


Private Sub Timer1_Timer()
If Me.Top < posTengah Then
        Me.Top = Me.Top + ((posTengah - Me.Top) / 2)
    Else
        Me.Top = posTengah
        Me.Timer1.Interval = 0
    End If
End Sub


Private Sub Timer2_Timer()
If Me.Top < Screen.Height Then
        Me.Top = Me.Top + ((Me.Top - posTengah) * 2)
    Else
        Unload Me
    End If
End Sub


Private Sub Timer3_Timer()
Keluar
End Sub


FORM LAPORAN

Rancangan Formnya





Tabel Tool :


Kode Programnya :
Option Explicit

Private koneksi As ADODB.Connection


Private Function konek() As Boolean
    On Error GoTo out
        Set koneksi = New ADODB.Connection
        koneksi.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\DbSekolah.mdb;Persist Security Info=False"
        koneksi.CursorLocation = adUseClient
        konek = True
out:
End Function




Private Sub CariNama_Click()
Adodc1.Recordset.Filter = "Nama ='" & TxtNama & "'"
End Sub


Private Sub CariOP_Click()
Adodc1.Recordset.Filter = "Operator='" & TxtOperaotor & "'"
End Sub


Private Sub CariTgl_Click()
Adodc1.Recordset.Filter = "Tanggal='" & DTPicker1.Value & "'"
End Sub


Private Sub CmdCari_Click()
If Adodc1.Recordset.RecordCount <= 0 Then Exit Sub
     Adodc1.Recordset.MoveFirst
     Adodc1.Recordset.Find "NIS='" & TxtCari.Text & "'"
End Sub


Private Sub CmdCetak_Click()
DataReportPembayaran.Show
End Sub


Private Sub CmdHapus_Click()
Dim X As String
X = MsgBox(("Anda Yakin data ingin di hapus?"), vbYesNo + vbCritical)
If X = vbYes Then
Adodc1.Recordset.Delete
Adodc1.Recordset.MoveFirst
DataGrid1.ReBind
DataGrid1.Refresh
MsgBox "Data  telah di Hapus!", vbInformation + vbOKOnly = vbIgnore
End If
End Sub


Private Sub CmdRefresh_Click()
Adodc1.Refresh
DataGrid1.Refresh
End Sub


Private Sub Form_Load()
If Not konek() Then
        MsgBox "Gak bisa terhubung ke database!", vbCritical
        End
    End If
    Adodc1.ConnectionString = koneksi.ConnectionString
    Adodc1.RecordSource = "Pembayaran"
    Set DataGrid1.DataSource = Adodc1
End Sub


Private Sub TxtCari_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Call CmdCari_Click
End If
End Sub

FORM SETING ADMINISTRATOR


Tabel TOOL :




Kode Programnya:
Option Explicit
Dim posTengah As Integer
Private koneksi As ADODB.Connection


Private Function konek() As Boolean
    On Error GoTo out
        Set koneksi = New ADODB.Connection
        koneksi.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\DbSekolah.mdb;Persist Security Info=False"
        koneksi.CursorLocation = adUseClient
        konek = True
out:
End Function


Sub CekPass()
If Textpass.Text = Text1.Text Then

Else
MsgBox "Adminstrator Name & Password tidak cocok ini!", vbOKOnly + vbCritical, "UnAuthorized"
Textadm.Text = ""
Textpass.Text = ""
Text1.Text = "5457hhh43%*tyy*&^.,ll%$$#$#$"
End If
End Sub


Private Sub CmdBatal_Click()
Textadm.Text = ""
Textpass.Text = ""
TxtAdm.Text = ""
TxtPass.Text = ""
TxtNama.Text = ""
CmdGanti.Caption = "Ganti"
CmdTambah.Caption = "Tambah"
CmdTambah.Enabled = True
CmdKeluar.Enabled = True
End Sub


Private Sub CmdGanti_Click()
If CmdGanti.Caption = "Ganti" Then
CmdGanti.Caption = "Simpan"
CmdTambah.Enabled = False
CmdKeluar.Enabled = False
Textadm.SetFocus
Else
CekPass
With Adodc1.Recordset
.Fields("Administrator") = TxtAdm.Text
.Fields("Pasword") = TxtPass.Text
.Fields("Nama") = TxtNama.Text
.Update
End With
MsgBox "Nana dan Pasword Telah Diganti!", vbInformation + vbOKOnly = vbIgnore
Call CmdBatal_Click
End If
End Sub


Private Sub CmdHapus_Click()
Dim x As String
x = MsgBox(("Anda Yakin data ingin di hapus?"), vbYesNo + vbCritical)
If x = vbYes Then
  If Textpass.Text = Text1.Text Then
    Adodc1.Recordset.Delete
    Adodc1.Recordset.MoveFirst
    DataGrid1.ReBind
    DataGrid1.Refresh
    MsgBox "Operator telah di Hapus!", vbInformation + vbOKOnly = vbIgnore
  Else
    MsgBox "Adminstrator Name & Password tidak cocok ini!", vbOKOnly + vbCritical, "UnAuthorized"
    Textadm.Text = ""
    Textpass.Text = ""
    TxtNama.Text = ""
    Text1.Text = "5457hhh43%*tyy*&^.,ll%$$#$#$"
  End If
End If
End Sub


Private Sub CmdKeluar_Click()
If MsgBox("Yakin mau keluar?", vbQuestion + vbYesNo) = vbYes Then
        Keluar
    End If
End Sub
Sub Keluar()
    posTengah = Me.Top
    Me.Top = Me.Top + 10
    Me.Timer2.Interval = 50
End Sub
Private Sub CmdTambah_Click()
If CmdTambah.Caption = "Tambah" Then
CmdGanti.Enabled = False
CmdHapus.Enabled = False
CmdTambah.Caption = "Simpan"
Else
If MsgBox("Anda yakin data sudah benar", vbQuestion + vbYesNo) = vbYes Then
With Adodc1.Recordset
.AddNew
.Fields("Adminstrator") = TxtAdm.Text
.Fields("Pasword") = TxtPass.Text
.Fields("Nama") = TxtNama.Text
.Update
End With
MsgBox "Operator telah di tambah!", vbInformation + vbOKOnly = vbIgnore
Call CmdBatal_Click
CmdGanti.Enabled = True
CmdHapus.Enabled = True
End If
End If
End Sub

Private Sub Form_Activate()
FrmAdmin.Height = 4560
End Sub


Private Sub Form_Load()
If Not konek() Then
        MsgBox "Gak bisa terhubung ke database!", vbCritical
        End
    End If
    Adodc1.ConnectionString = koneksi.ConnectionString
    Adodc1.RecordSource = "Login"
    Set DataGrid1.DataSource = Adodc1
    Me.Top = Me.Height * -1
    Me.Left = (Screen.Width - Me.Width) / 2
    posTengah = (Screen.Height - Me.Height) / 2
    Me.Timer1.Interval = 50
End Sub


Private Sub Textadm_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Adodc1.Recordset.Find "Adminstrator='" + Textadm.Text + "'", , adSearchForward, 1
If Not Adodc1.Recordset.EOF Then
     Text1.Text = Adodc1.Recordset!Pasword
     TxtNama.Text = Adodc1.Recordset!Nama
     Textpass.SetFocus
Else
    Textpass.SetFocus
End If

End If
End Sub


Private Sub Textpass_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
TxtAdm.SetFocus
End If
End Sub


Private Sub Timer1_Timer()
 If Me.Top < posTengah Then
        Me.Top = Me.Top + ((posTengah - Me.Top) / 2)
    Else
        Me.Top = posTengah
        Me.Timer1.Interval = 0
    End If
End Sub


Private Sub Timer2_Timer()
If Me.Top < Screen.Height Then
        Me.Top = Me.Top + ((Me.Top - posTengah) * 2)
    Else
        Unload Me
    End If
End Sub


Private Sub TxtAdm_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
TxtPass.SetFocus
End If
End Sub


Private Sub TxtPass_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
TxtNama.SetFocus
End If
End Sub



Pembayaran SPP.rar
Program_Pembayaran_SPP.pdf

Form Login



Kode Programnya adalah:
Option Explicit
Dim x As Integer
Private koneksi As ADODB.Connection


Private Function konek() As Boolean
    On Error GoTo out
        Set koneksi = New ADODB.Connection
        koneksi.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\DbSekolah.mdb;Persist Security Info=False"
        koneksi.CursorLocation = adUseClient
        konek = True
out:
End Function


Private Sub CmdBatal_Click()
Unload Me
End Sub


Private Sub CmdOK_Click()
If TxtPass.Text = TextCek.Text Then
    With Adodc2.Recordset
    .Fields("Administrator") = LbName.Caption
    .Fields("Tanggal") = MaskEdBox1.Text
    .Fields("Jam_Login") = LbJam.Caption
    .Update
    End With
        MsgBox "AKSES DITERIMA ! Selamat Datang, " & UCase(TxtAdmin), , "OK"
      Unload Me
       FrmSPP.Show
     Else
         If x = 3 Then
        MsgBox "Anda tidak berhak mengoperasikan aplikasi ini!", vbOKOnly + vbCritical, "UnAuthorized"
        End
        Else
        MsgBox "Password& Admin SALAH, masukkan lagi Admin & passwordnya!" & Chr(10) & "Kesempatan anda" & 3 - x & " lagi", vbOKOnly + vbCritical, "Password Salah"
        x = x + 1
                TxtAdmin.Text = ""
                TxtPass = ""
                TextCek.Text = "rtbr345435*&^#2325hhutyu6788"
                TxtAdmin.SetFocus
           Exit Sub
         End If
    End If
End Sub


Private Sub Form_Activate()
‘mengatur tiggi form Login
FrmLogin.Height = 3300
 x = 1
‘Kode Mengseting tanggal
Dim t$
    Dim thn$, bln$, tgl$
    t = MaskEdBox1.Text
    If t <> "__/__/__" Then
        thn = Right(t, 4)
        bln = Mid(t, 4, 2)
        tgl = Left(t, 2)
       
        If IsDate(thn & "-" & bln & "-" & tgl) = False Then
                 MaskEdBox1.Text = Format(Now, "dd/MM/yyyy")
        End If
    End If
End Sub


Private Sub Form_Load()
If Not konek() Then
        MsgBox "Gak bisa terhubung ke database!", vbCritical
        End
    End If
    Adodc1.ConnectionString = koneksi.ConnectionString
    Adodc1.RecordSource = "Login"
    Set DataGrid1.DataSource = Adodc1
    Adodc2.ConnectionString = koneksi.ConnectionString
    Adodc2.RecordSource = "AktifvitasOP"
    Set DataGrid1.DataSource = Adodc2
End Sub





Private Sub Timer1_Timer()
‘Jam Hitungan 24 Jam
Dim dblSecond As Double, dblMinute As Double, dblHour As Double
dblSecond = Second(Now) * 6 - 90
dblMinute = (Minute(Now) + Second(Now) / 60) * 6 - 90
dblHour = (Hour(Now) + Minute(Now) / 60) * 30 - 90
LbJam.Caption = Format(Now, "hh:mm:ss")
End Sub


Private Sub TxtAdmin_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Adodc1.Recordset.Find "Adminstrator='" + TxtAdmin.Text + "'", , adSearchForward, 1
If Not Adodc1.Recordset.EOF Then
     TextCek.Text = Adodc1.Recordset!Pasword
     LbName.Caption = Adodc1.Recordset!Nama
Else
  



End If
TxtPass.SetFocus
End If
End Sub
Private Sub TxtPass_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Call CmdOK_Click
End If
End Sub







Pembayaran SPP.rar
Program_Pembayaran_SPP.pdf