i am using vb6.0 and crystal report11 and MS ACCESS database how to create a crystal report at run time from a vb form i dont have any idea regarding this please give some suggestions or code would be very helpful to me

this is wht i did in my project

first design ur report thru crystal reports

in a form(vb) u just add the crviewercontrol

then write the code using this logic

Private Sub cmdReportOK_Click()
Dim m_Report As CRAXDDRT.Report
Dim m_Application As New CRAXDDRT.Application
Set m_Report = Nothing
Set m_Report = m_Application.OpenReport(App.Path + "\myreport.rpt", 1)
    m_Report.ParameterFields.Item(1).AddCurrentValue cmbReport.Text
    m_Report.ParameterFields.Item(2).AddCurrentValue dtpFrom.Value
    m_Report.ParameterFields.Item(3).AddCurrentValue dtpTo.Value
With CRViewer1
    .EnableExportButton = True
    .EnablePrintButton = True
    .EnableCloseButton = True
    .ReportSource = m_Report
    .ViewReport
End With
End Sub

What reference needs to be added to VB to use the CRAXDDRT add it?

Thanks.
phil.sloan@dsm.com


this is wht i did in my project

first design ur report thru crystal reports

in a form(vb) u just add the crviewercontrol

then write the code using this logic

Private Sub cmdReportOK_Click()
Dim m_Report As CRAXDDRT.Report
Dim m_Application As New CRAXDDRT.Application
Set m_Report = Nothing
Set m_Report = m_Application.OpenReport(App.Path + "\myreport.rpt", 1)
    m_Report.ParameterFields.Item(1).AddCurrentValue cmbReport.Text
    m_Report.ParameterFields.Item(2).AddCurrentValue dtpFrom.Value
    m_Report.ParameterFields.Item(3).AddCurrentValue dtpTo.Value
With CRViewer1
    .EnableExportButton = True
    .EnablePrintButton = True
    .EnableCloseButton = True
    .ReportSource = m_Report
    .ViewReport
End With
End Sub

first do u have the crviewer in ur components
it will take all the references automatically

otherwise you just select all the related references to crystal reports

let me know wht version of cr u r using

first design the report in crystal reports
add a crystal report viewer in ur form
write the code like in the 2nd post of this thread..

try first if u hav any prob come back to me

This article has been dead for over six months. Start a new discussion instead.