I'm using CR7 Viewer in VB6, if I used parameters to show a report in the viewer and then want to see the same report with different parameters the viewer shows allways the report with the first chosen parameters. No matter how many reports were open the viewer remember the first parameter for each reports. Toggle Breakpoint always show the new parameters are passed to SQL statements from controls.<br>
Statement is below:<br>
Private Sub cmdCreate_Click()<br>
On Error GoTo ErrorLevel<br>
<br>
Screen.MousePointer = vbHourglass<br>
<br>
Dim MainRS As New ADODB.Recordset<br>
Dim strSQL As String<br>
<br>
Select Case UCase$(cbReportList.ListIndex)<br>
Case 0 ' "All Cancer Types by Year(s)"<br>
strSQL = "SELECT * FROM qryCancer" _<br>
& " WHERE MinDate >= " & cbStartYear.Text _<br>
& " AND MaxDate <= " & cbEndYear.Text<br>
<br>
MainRS.Open strSQL, m_AdoConnection, adOpenDynamic, _ adLockReadOnly<br>
<br>
If MainRS.EOF Then Err.Raise vbObjectError + 1000<br>
rptAllCancer.Database.Tables.Item(1).SetDataSource MainRS<br>
CRViewer1.ReportSource = rptAllTypes<br>
End Select<br>
<br>
While CRViewer1.IsBusy<br>
DoEvents<br>
Wend<br>
<br>
CRViewer1.ViewReport<br>
<br>
Continue:<br>
On Error Resume Next<br>
<br>
SubRS.Close<br>
MainRS.Close<br>
Set SubRS = Nothing<br>
Set MainRS = Nothing<br>
<br>
Screen.MousePointer = vbDefault<br>
<br>
Exit Sub<br>
<br>
This statments are not working<br>
CRViewer1.ReportSource.Close<br>
CRViewer1.Refresh<br>
CRViewer1.ReportSource.Nothing<br>
CRViewer1.ActivateView<br>
<br>
Statement is below:<br>
Private Sub cmdCreate_Click()<br>
On Error GoTo ErrorLevel<br>
<br>
Screen.MousePointer = vbHourglass<br>
<br>
Dim MainRS As New ADODB.Recordset<br>
Dim strSQL As String<br>
<br>
Select Case UCase$(cbReportList.ListIndex)<br>
Case 0 ' "All Cancer Types by Year(s)"<br>
strSQL = "SELECT * FROM qryCancer" _<br>
& " WHERE MinDate >= " & cbStartYear.Text _<br>
& " AND MaxDate <= " & cbEndYear.Text<br>
<br>
MainRS.Open strSQL, m_AdoConnection, adOpenDynamic, _ adLockReadOnly<br>
<br>
If MainRS.EOF Then Err.Raise vbObjectError + 1000<br>
rptAllCancer.Database.Tables.Item(1).SetDataSource MainRS<br>
CRViewer1.ReportSource = rptAllTypes<br>
End Select<br>
<br>
While CRViewer1.IsBusy<br>
DoEvents<br>
Wend<br>
<br>
CRViewer1.ViewReport<br>
<br>
Continue:<br>
On Error Resume Next<br>
<br>
SubRS.Close<br>
MainRS.Close<br>
Set SubRS = Nothing<br>
Set MainRS = Nothing<br>
<br>
Screen.MousePointer = vbDefault<br>
<br>
Exit Sub<br>
<br>
This statments are not working<br>
CRViewer1.ReportSource.Close<br>
CRViewer1.Refresh<br>
CRViewer1.ReportSource.Nothing<br>
CRViewer1.ActivateView<br>
<br>