1. Buatlah sebuah form baru lalu Designlah seperti dibawah ini.
2. Kemudian tambahkan komponen Adodc dan komponen Crystal Report lalu setting Adodc
dan setting Crystal Report.
Note : Untuk setting Crystal Report sama seperti setting Adodc.
3. Kemudian masukan listing di bawah ini.
Dim semester As Integer
Dim jurusan As String
Private Sub Command11_Click()
Dim pesan As String
If Combo1 = "" And Combo2 = "" Then
pesan = MsgBox("Tentukan Jurusan dan Semester ......?", vbOKOnly + vbInformation, "Peringatan!!")
Combo1.SetFocus
ElseIf Combo1 = "" Then
pesan = MsgBox("Tentukan jurusan ......?", vbOKOnly + vbInformation, "Peringatan!!")
Combo1.SetFocus
ElseIf Combo2 = "" Then
pesan = MsgBox("Tentukan semester ......?", vbOKOnly + vbInformation, "Peringatan!!")
Combo2.SetFocus
Else
CrystalReport1.SelectionFormula = "{tbmahasiswa.jurusan}='" & Combo1.Text & "'and {tbmahasiswa.semester}='" & Combo2.Text & "'"
CrystalReport1.ReportFileName = App.Path & "\Laporan\Report1.rpt"
CrystalReport1.RetrieveDataFiles
CrystalReport1.WindowState = crptMaximized
CrystalReport1.ReportTitle = Reportiduser
CrystalReport1.WindowTitle = "Report1"
2
CrystalReport1.PrinterSelect
Combo1 = ""
Combo2 = ""
End If
End Sub
Private Sub Command12_Click()
Dim pesan As String
If Combo1 = "" And Combo2 = "" Then
pesan = MsgBox("Tentukan Jurusan dan Semester ......?", vbOKOnly + vbInformation, "Peringatan!!")
Combo1.SetFocus
ElseIf Combo1 = "" Then
pesan = MsgBox("Tentukan jurusan ......?", vbOKOnly + vbInformation, "Peringatan!!")
Combo1.SetFocus
ElseIf Combo2 = "" Then
pesan = MsgBox("Tentukan semester ......?", vbOKOnly + vbInformation, "Peringatan!!")
Combo2.SetFocus
Else
CrystalReport1.SelectionFormula = "{tbmahasiswa.jurusan}='" & Combo1.Text & "'and {tbmahasiswa.semester}='" & Combo2.Text & "'"
CrystalReport1.ReportFileName = App.Path & "\Laporan\Report1.rpt"
CrystalReport1.RetrieveDataFiles
CrystalReport1.WindowState = crptMaximized
CrystalReport1.ReportTitle = Reportiduser
CrystalReport1.WindowTitle = "Report1"
CrystalReport1.PrintReport
Combo1 = ""
Combo2 = ""
End If
End Sub
Private Sub Command9_Click()
Dim pesan As String
pesan = MsgBox("anda yakin mau keluar", 4 + 32, "penting")
If pesan = vbYes Then
Do
Me.Left = Me.Left + 30
Me.Move Me.Left, Me.Top
DoEvents
Loop Until Me.Left > Screen.Width - 500
CetakDataMahasiswa.Hide
0 comments:
Post a Comment