Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating a report using Crystal Reports in VB .NET

Status
Not open for further replies.

tornadoproggie

Programmer
Jul 11, 2002
6
0
0
US
Hi,

I am trying to create a report in VB .net using crystal reports. My application is like this;

I have a form where I select a particular value in a combo box. On selecting the value, there are 7 tables with this selected field as the primary key, now I have to display the values in all the tables in my report. is it poosible to do this using the inbuilt crystal reports that comes with VS .net or do I have to buy the complete thing. Also how can I dynamically populate the report?
 
tornadoproggie,

If you have the VS .NET then you have a full version of crystal that you can use to create and distribute reports with. When designing your report you want to setup that on field as a parameter so that you can then pass in the data and have the report fill in with all the appropriate data.
-Bueller
 
Give this a try... I worked this out and seems to do what I want... with a cboBox:

Please note that the "Groups" collection is dependant on the number of groupings you have in your report. I have two, so I am only manipulating the "second" sort group. So if you have "one," use 0.

Bob Taylor

Private Sub cboOption_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cboOption.SelectedIndexChanged
Try
Dim FieldDef As FieldDefinition
Dim rpt As New rptPlacementReport
'
Select Case cboOption().Text
Case "Age"
FieldDef = rpt.Database.Tables("tblFITClients").Fields("DOB")
rpt.DataDefinition.Groups.Item(1).ConditionField = FieldDef
Case "Gender"
FieldDef = rpt.Database.Tables("tblFITlstGender").Fields("Description")
rpt.DataDefinition.Groups.Item(1).ConditionField = FieldDef
Case "Ethnicity"
FieldDef = rpt.Database.Tables("tblFITlstEthnic").Fields("Description")
rpt.DataDefinition.Groups.Item(1).ConditionField = FieldDef
End Select
'
ctlCRViewer.Zoom(2)
'
rpt.SetDataSource(ds)
ctlCRViewer.ReportSource = rpt
Catch ex As Exception
MessageBox.Show("Report Error: " & ex.Message)

End Try

End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top