Hi! Can anybody tell me what's wrong with these codes? I am a newbie in Crystal Report and this is my first project. I want to produce a report based on the SQL statement that I make. Is there something wrong with the way I connect my database with the report? Also can you tell me what is the reference or dll file that makes this command work:
Dim Report as New CrystalReport1
I'm using VB6, MS Access and Crystal Report 8
Here are the codes:
Option Explicit
Private conn as ADODB.connection
Private rs As ADODB.Recordset
Public rephead As String
Dim SQL As String
Private Sub cmdPrint_Click()
SQL = "{tblReso1.ApprovDate} >= #" & mskPrintDate1.Text & "# And {tblReso1.ApprovDate} <= #" & mskPrintDate2.Text & "# order by ResoNum"
rephead = "RESOLUTIONS PASSED FROM " & Format(mskPrintDate1.Text, "mmmm dd, yyyy" & " TO " & Format(mskPrintDate2.Text, "mmmm dd, yyyy"
With CrystalReport1
.ReportFileName = App.Path & "\reso.rpt"
.ReplaceSelectionFormula ("SQL"
.Formulas(0) = "header = '" & rephead & "'"
.PrintReport
End With
End Sub
Private Sub Form_Load()
Set conn = New ADODB.Connection
conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\sp\sp.mdb;Persist Security Info=False"
mskPrintDate1.Mask = "##/##/####"
mskPrintDate2.Mask = "##/##/####"
mskPrintDate1.Text = Format(Date, "mm/dd/yyyy"
mskPrintDate2.Text = Format(Date, "mm/dd/yyyy"
End Sub
Please help!
Dim Report as New CrystalReport1
I'm using VB6, MS Access and Crystal Report 8
Here are the codes:
Option Explicit
Private conn as ADODB.connection
Private rs As ADODB.Recordset
Public rephead As String
Dim SQL As String
Private Sub cmdPrint_Click()
SQL = "{tblReso1.ApprovDate} >= #" & mskPrintDate1.Text & "# And {tblReso1.ApprovDate} <= #" & mskPrintDate2.Text & "# order by ResoNum"
rephead = "RESOLUTIONS PASSED FROM " & Format(mskPrintDate1.Text, "mmmm dd, yyyy" & " TO " & Format(mskPrintDate2.Text, "mmmm dd, yyyy"
With CrystalReport1
.ReportFileName = App.Path & "\reso.rpt"
.ReplaceSelectionFormula ("SQL"
.Formulas(0) = "header = '" & rephead & "'"
.PrintReport
End With
End Sub
Private Sub Form_Load()
Set conn = New ADODB.Connection
conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\sp\sp.mdb;Persist Security Info=False"
mskPrintDate1.Mask = "##/##/####"
mskPrintDate2.Mask = "##/##/####"
mskPrintDate1.Text = Format(Date, "mm/dd/yyyy"
mskPrintDate2.Text = Format(Date, "mm/dd/yyyy"
End Sub
Please help!