Connect CR 8.5 dengan VB 6
Postingan kali ini saya memberikan contoh coding koneksi Crystal Report 8.5 dengan Visual Basic 6.0, adapun contoh barisan coding sebagai berikut :
- Private Sub cmdbuat_Click()
- Dim saring As String
- If DTPicker1.Value > DTPicker2.Value Then
- MsgBox "Periode Salah", vbCritical, "Periode"
- Else
- saring = "{TrAbsensi.TglMasuk} >= #" & Format(DTPicker1.Value, "mm/dd/yyyy
- 00:00:00") & "#" & _
- "and {TrAbsensi.TglMasuk} <= #" & Format(DTPicker2.Value, "mm/dd/yyyy
- 00:00:00") & "#"
- CR.WindowTitle = "Laporan Absensi"
- CR.ReportFileName = App.Path + "\Reports\LapAbsensi.rpt"
- CR.Formulas(1) = "tgl1='" & Format(DTPicker1.Value, "dd/mm/yyyy") & "'"
- CR.Formulas(2) = "tgl2='" & Format(DTPicker2.Value, "dd/mm/yyyy") & "'"
- CR.Formulas(3) = "IDBAG='" & Combo2.Text & "'"
- If Combo2.Text <> "Semua" Then
- CR.ReplaceSelectionFormula (saring & " and {MstKaryawan.Nama} = '" &
- Combo2.Text & "' and {MstKaryawan.IDbagian} = '" & Combo1.Text & "'")
- Else
- CR.ReplaceSelectionFormula (saring & " and {MstKaryawan.IDbagian} = '" &
- Combo1.Text & "'")
- End If
- CR.Destination = crptToWindow
- CR.WindowState = crptMaximized
- CR.Action = 1
- End If
- End Sub
Mas, saya sudah coba kok malah muncul error "Can't Open Database"? Mohon petunjuknya terimakasih
BalasHapusKalau berdasarkan pengalaman saya error tersebut di karenakan koneksi di Crystal Report dengan koneksi di Visual Basic tidak match.. Coba perhatikan DNS nya. Trims
BalasHapus