-
You can use the Selection Formula of the Crystal Report.
-
If you are using Crystal Report's OCX Control check with its selection criteria property which can be set within Visal Basic. For more help check on Developers.hlp in crystal directory.
Indraneel
-
I always create a separate table for reporting, so I can format it the way I want. If you create a new table for this report, then you can clear the table, and fill it only with the records you need for the report.
Hope this helps,
-
I think the easiest way is to set your report datasource to a recordset that you create.
Such as:
Code:
Dim rstCurrent As ADODB.Recordset
Dim strSql As String
Dim Report1 As rptClient
Screen.MousePointer = vbHourglass
strSql = "SELECT * FROM client WHERE lastname = 'Smith' ORDER BY firstname"
'Load a form with the reportviewer control on it.
Load frmReport
'open your recordset
Set rstCurrent = New ADODB.Recordset
rstCurrent.Open strSql, fCnn1, adOpenForwardOnly, , adCmdText
'load your report
Set Report1 = New rptClient
'set your report's datasource
Report1.Database.SetDataSource rstCurrent
frmReport.crvCommon.ReportSource = Report1
frmReport.crvCommon.ViewReport
frmReport.crvCommon.Visible = True
frmReport.Show
Screen.MousePointer = vbDefault
Hope this helps.