Quote:
> HI everyone :-)
> I have a problem using VB6SP5 with a report created in CR 8.5 dev.
> The report's fields definitions are in a ttx file, and in CR everything
> works fine (if I try the preview, I can see the sample data that I wrote
> into the ttx file). But if I try to pass a recordset to the report from
VB,
> I don't see anything!
> Here is the code I use:
> rs.Open "SELECT * FROM r001", cn, adOpenForwardOnly, adLockReadOnly
> With frmReport.CRViewer1
> Set rpt = rdApp.OpenReport(repPath & FastQuery(cn, "SELECT
> NomeFile FROM _sys_Reports WHERE Codice=1"))
> rpt.Database.Tables(1).SetDataSource rs
> rpt.ParameterFields(1).AddCurrentValue 7
> .ReportSource = rpt
> .ViewReport
> End With
> frmReport.Show
> rs.Close
> Can anyone help me? Thanks!
I use ttx reports like this.
Gregor.
Set CR = New RInvoice1 'this is your instance of the *.drs file
Set RST= New ADODB.Recordset
RST.CursorType = adOpenStatic
RST.LockType = adLockReadOnly
RST.Open sqlTotals, Conn 'create your recordset
With CR
.Database.SetDataSource RST, , 1
.ParameterFields(1).AddCurrentValue 7
'------on screen:--------------------------------------
Load FReport 'load your form that contains the report
viewer component
FReport.WindowState = vbMaximized
FReport.CRViewer.ReportSource = CR
FReport.CRViewer.ViewReport
FReport.CRViewer.Zoom (1) '2= Page Width, 1 = Whole Page, other =
zoom level (int)
Screen.MousePointer = 0
FReport.Show vbModal
Unload FReport
End With
'Closing all the recordset and classes:
RST.Close
Set RST = Nothing
Set CR = Nothing