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

CR7 Viewer in VB6 does't show same report with new parameters

Status
Not open for further replies.

leszek

Programmer
Aug 25, 1999
2
CA
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 &gt;= " & cbStartYear.Text _<br>
& " AND MaxDate &lt;= " & 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>

 
At the Unload event, try setting the ReportSource = Nothing.

ie. set rptAllTypes = Nothing

The next time you preview the report, it should appear with the most recent data.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top