Apr 11th, 2004, 05:27 AM
#1
Thread Starter
Hyperactive Member
Crystal Report
Hi,
I am totally new to Crystal reporting. I even don't know how to add a report to a VB program. I hope somebody will help me on this.
I have a main form with a command button called Report. When this command button is clicked, I have another form with some option buttons to choose what type of report they want to view. When the OK button is clicked, the report should be displayed depending on the criteria the user opted. Can this be done? Please help.
Thanks
Apr 15th, 2004, 07:43 AM
#2
PowerPoster
Yes, it can be done.
What level VB and what level CR?
Apr 15th, 2004, 08:23 AM
#3
Hyperactive Member
I use the pull down menu of the MDIForm (Parent form). This will call a child form that has a grid with all my reports.
User double clicks on the GRID on the report they want.
VB Code:
Private Sub dbgREPORTS_DblClick()
If adoRS.RecordCount > 0 Then
REPORT_DIR = App.Path & adoRS.Fields(1) '-- REPORT_DIR is a global variable
frmREPORTVIEW.Show
End If
End Sub
The report is rendered on another form.
VB Code:
Option Explicit
Dim crxApplication As New CRAXDRT.Application
Dim crxReport As CRAXDRT.Report
Private Sub Form_Load()
Set crxApplication = New CRAXDRT.Application
Set crxReport = crxApplication.OpenReport(REPORT_DIR) '--Report name is passed here from the report menu form
With crxReport.Database.Tables(1).ConnectionProperties
.Item("Provider") = "xxxxxxxx"
.Item("Data source") = "xxxxxxxx"
.Item("Initial Catalog") = "xxxxxx"
.Item("User ID") = "xxxxxxx"
.Item("Password") = "xxxxxxx"
End With
Dim CRXParamDefs As CRAXDRT.ParameterFieldDefinitions
Dim CRXParamDef As CRAXDRT.ParameterFieldDefinition
' crxReport.PrinterSetup (0) '<-- THIS BRINGS UP THE PRINTER DIALOGUE BOX
CRViewer91.ReportSource = crxReport
CRViewer91.ViewReport
End Sub
Private Sub Form_Resize()
With CRViewer91
.Top = 0
.Left = 0
.Width = Me.ScaleWidth
.Height = Me.ScaleHeight
End With
End Sub
Private Sub Form_Unload(Cancel As Integer)
Set crxReport = Nothing
Set crxApplication = Nothing
End Sub
Attached Images
Apr 17th, 2004, 07:29 AM
#4
Thread Starter
Hyperactive Member
I use VB6 and CR10.
Thanks
Posting Permissions
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Rules
Click Here to Expand Forum to Full Width