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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Record Source for Subreports

Status
Not open for further replies.

smil3y

IS-IT--Management
Jan 8, 2004
79
AU
I am using code as follows (see code below) to refresh data for a report via VB 6. It all works fine - whenever the date or selected employer is changed the data is refreshed.

I have now included a subreport within the main report and need to refresh that data also. I was hoping I could use something similar to:

TrainingReport.Database.SetDataSource rsadoReport

and insert the subreport after TrainingReport (TrainingReport has been Dim TrainingReport as new crTraining (the crystal reports report). Although I can go
TrainingReport.subreport - I can not set the datasource.

Am I able to do this - can someone please help me. Regards



If CRVReport.IsBusy Then Exit Sub
Screen.MousePointer = vbHourglass
DTShowStartDate.Enabled = False
DTShowEndDate.Enabled = False
cboListing.Enabled = False
TrainingReport.IsNoData = False

SQL = "Select * from qryTraining Where " & _
"(((qryTraining.DateDue) >= #" & Format(DTShowStartDate, "mm/dd/yyyy") & "#))" & _
&quot; AND (((qryTraining.DateDue) <= #&quot; & Format(DTShowEndDate, &quot;mm/dd/yyyy&quot;) & &quot;#))&quot;
Debug.Print SQL

If cboListing.Text <> vbAllTraining Then
lNameID = cboListing.ItemData(cboListing.ListIndex)

SQL = SQL & &quot; AND qryTraining.QualID = &quot; & lNameID
End If

rsadoReport.Close
rsadoReport.Open SQL, Con, adOpenDynamic, adLockBatchOptimistic

TrainingReport.Database.SetDataSource rsadoReport

If CRVReport.Visible Then
TrainingReport.ReadRecords
CRVReport.Refresh
End If
DTShowStartDate.Enabled = True
DTShowEndDate.Enabled = True
cboListing.Enabled = True
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top