Anda di halaman 1dari 3

VISUAL BASIC 6.

0 MEMBUAT FORM CETAK KWITANSI DAN LAPORAN HARIAN


ASEP JALALUDIN,S.T.,M.M. Halaman - 1
A. MEMBUAT FORM CETAK KWITANSI


Coding-nya sbb :

Private Sub Command1_Click()
If DataEnvironment1.rsCommand1.State = adStateOpen Then
DataEnvironment1.rsCommand1.Close
DataEnvironment1.rsCommand1.Open "SELECT * FROM daftar WHERE no_kwit='" +
Combo1.Text + "'"
DataReport1.Print
End Sub

Private Sub Command2_Click()
Unload Me
End Sub

Private Sub Command3_Click()
If DataEnvironment1.rsCommand1.State = adStateOpen Then
DataEnvironment1.rsCommand1.Close
DataEnvironment1.rsCommand1.Open "SELECT * FROM daftar WHERE no_kwit='" +
Combo1.Text + "'"
DataReport1.Show
End Sub

Private Sub Form_Load()
With DataEnvironment1
.Connection1.Provider = "Microsoft.Jet.OLEDB.4.0"
.Connection1.Open App.Path & "\pendaftaran.mdb"

With .rsCommand1
.Open "SELECT distinct(no_kwit) FROM daftar"
Do Until .EOF
Combo1.AddItem .Fields(0)
.MoveNext
VISUAL BASIC 6.0 MEMBUAT FORM CETAK KWITANSI DAN LAPORAN HARIAN
ASEP JALALUDIN,S.T.,M.M. Halaman - 2
Loop
.Close
End With
End With
End Sub

B. MEMBUAT FORM CETAK LAPORAN HARIAN


Coding-nya sbb :
Private Sub Command1_Click()
DataEnvironment1.rsCommand2.Open
DataEnvironment1.rsCommand2.Filter = ("tgl_daftar >= '" & Me.DTPicker1.Value & "'
and tgl_daftar <= '" & Me.DTPicker2.Value & "'")
DataReport2.Print
DataEnvironment1.rsCommand2.Close
End Sub

Private Sub Command2_Click()
DataEnvironment1.rsCommand2.Open
DataEnvironment1.rsCommand2.Filter = ("tgl_daftar >= '" & Me.DTPicker1.Value & "'
and tgl_daftar <= '" & Me.DTPicker2.Value & "'")
DataReport2.Show
DataEnvironment1.rsCommand2.Close
End Sub

Private Sub Command3_Click()
Unload Me
End Sub

Private Sub Command4_Click()
Me.DTPicker1.Value = Date
Me.DTPicker2.Value = Date
End Sub

VISUAL BASIC 6.0 MEMBUAT FORM CETAK KWITANSI DAN LAPORAN HARIAN
ASEP JALALUDIN,S.T.,M.M. Halaman - 3
Tapi sebelumnya di Command1 & Command2 pada Connection1 + DataEnvironment1-
nya harus dirubah SQL Statement-nya sbb :