VB How-ToAsk your "How do I do this with VB?" questions in this forum.
Welcome to the p2p.wrox.com Forums.
You are currently viewing the VB How-To section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
This is what I do using Crystal Reports 9 with VB6
When creating an ActiveX Designer Report (DSR), the Crystal Reports
Gallery dialog appears. Choose From an Existing Report and browse to
the report file. The Report file will be converted to a DSR for use with the RDC in Visual Basic.
The wizard does the rest.
Then enter your code as normal.
Because your finished exe may end up being large / more functionality
Add a Form
Insert controls - CommonDialog1 - CRViewer91
Dim lApplication As CRAXDRT.Application
Dim lReport As CRAXDRT.Report
Private Sub mnuFileOpen_Click()
Dim strRpt As String
'Set filters for the Open dialog to choose only a RPT file
CommonDialog1.Filter = "Report (*.rpt)|*.rpt"
'Set the filename selected to the string variable
strRpt = CommonDialog1.FileName
Set lApplication = New CRAXDDRT.Application
Set lReport = lApplication.OpenReport(strRpt) ' Open the report
CRViewer91.ReportSource = lReport
lReport.DiscardSavedData 'CLEARS REPORT SO WE WORK FROM NEW DATA
MsgBox Err.Description & " " & Err.Number
Private Sub Form_Resize()
CRViewer91.Top = 0
CRViewer91.Left = 0
CRViewer91.height = ScaleHeight
CRViewer91.Width = ScaleWidth