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" & "#))" & _
" AND (((qryTraining.DateDue) <= #" & Format(DTShowEndDate, "mm/dd/yyyy" & "#))"
Debug.Print SQL
If cboListing.Text <> vbAllTraining Then
lNameID = cboListing.ItemData(cboListing.ListIndex)
SQL = SQL & " AND qryTraining.QualID = " & 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
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" & "#))" & _
" AND (((qryTraining.DateDue) <= #" & Format(DTShowEndDate, "mm/dd/yyyy" & "#))"
Debug.Print SQL
If cboListing.Text <> vbAllTraining Then
lNameID = cboListing.ItemData(cboListing.ListIndex)
SQL = SQL & " AND qryTraining.QualID = " & 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