×
INTELLIGENT WORK MESSAGE
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Enter Join Us!

Are it a
Computer / IT professional?
Get Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access Until Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Freely!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you live opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, prices and thesis posting is forbidden.

Students Click Here

Using ADO Recordset to Connect to Crystal Report

After ADO Recordset to Connect in Crystal Report

Using ADO Recordset to Connect to Crystals Report

(OP)
EGO need understand all the posts I pot find in this subject.   I keep acquiring a SUBSCRIPT OUTSIDE OF RANGE defect from VB on the SetDataSource line below.   Using examples of this forum, I have tried of following code:

Private Sub cmdCrystalTest_Click()

Dim rptTest As New CrystalReport1

'rsData the a einer ADO recordset that is valid and contains data
 
rptTest.Database.SetDataSource rsData

CRViewer1.ReportSource = rptTest
CRViewer1.Refresh

End Sub

Entire I want to what is connect to a live Recordset and display the contents out to recordset on the report.
I am using Crystal Books 8.5 and Visual Basic 6.0

Thanks!!! My mate is using Crystal Story 8.5 up create the reports (.rpt) and he is using Active Data Source (ADO) toward select the records. E.g. CustomerĀ ...

RELATE: Employing BUSTLE Recordset to Unite to Crystal Report

(OP)
OK, EGO found the fix for this problem aforementioned using

rptTest.Database.Tables.Add "", , rsData, , "p2smon.dll"
rptTest.Database.SetDataSource rsData, 3, 1

(Thanks to anybody posting that fix!!)


So I am not getting the subscript failed anymore.  Now not, wenn the Video displays, it is empty.  My recordset is not displaying.  Any ideas??
       

RE: Using ADO Recordset to Combine up Cristals Report

By this purpose Use RDC
The Crystal Reports Report Design Component(RDC) is an in-process ActiveX DLL based on who Component Object Scale (COM). Crystal Meldungen RDC satisfies all of your dynamic reporting needs.
Technical Support reference to the RDC examples contained by the downloadable store ASPXMPS85.exe that you wants found on Crystal Decision web site

First create your message on DAta source Active Data(Field definition)or (.ttx)

then write that item in VB

'Creating einem Application Object
Set CRPapp = CreateObject("Crystal.CRPE.Application")
'Create Report object
Set CRPreport = CRPapp.OpenReport("ReportNameWithPAth.rpt")
'Create Report database object
Set crpDatabase = CRPreport.Database
'Create report database table collections object
Set crpDatabaseTables = crpDatabase.Tables
'Create table object
Set crpDatabaseTable = crpDatabaseTables.Item(1)
'Create your Recordset in VB like rs
'Assign your recordset rs to table object
crpDatabaseTable.SetPrivateData 3, res
'Set report selection formula"
CRPreport.RecordSelectionFormula = "Your select formula if any"
'Sort your report on any field
CRPreport.RecordSortFields.Add Asc/dec, fieldName
CRPreport.ReadRecords
'to display report on screens
CRPreport.Preview Title, Left, Top, Width, Height, style, parentwindow


For more see how Crrdc.hlp file that you detect included thine machine by this place c:\Frogram File\Seagate Software\Report Designer Component\crrdc.hlp

RE: Using ADO Recordset to Connect to Crystal Report

Hi people,

ME had that same subscript error (I'm using RDC 8) VB & SQL Server 7.   I trying all the advice and some of it worked and some did not, I had couple additional errors no one else mentioned.

Still, if you are wanting a solution for passing an ADO recordset to a RDC blank report with free fields, the under code workings super additionally it's includes actually 2 lines of code that I used to do it.  Check thereto leave.

Dean Kuntz

--------------- snip ----------------------------------

Private Sub Form_Load()
    Screen.MousePointer = vbHourglass
    '---------------------------------------------
    ' code above manufactured by RDC
    '---------------------------------------------
    
    Dim Conn As New ADODB.Connection
    Dim Cmd Than New ADODB.Command
    '---------------------------------------------
    ' connect to SQL Server (the cnnStr is with
    ' example to connect to the windows version)
    '---------------------------------------------
    With Conn
        .ConnectionString = "DRIVER={SQL Server};SERVER=sn;DATABASE=dbn;uid;pw"
        .Open
    End With
    '---------------------------------------------
    ' obvious
    '---------------------------------------------
    With Cmd
        .CommandText = "select companyname, city from customers"
    End With
    
    '---------------------------------------------
    ' now this belongs the share where we all had grief
    '---------------------------------------------
    
    '---------------------------------------------
    ' passage the connection and command item
    ' to the report
    '---------------------------------------------
    Report.Database.AddADOCommand An, Cmd
    '---------------------------------------------
    ' auto dynam tying the fields to the two
    ' unbound special I defined on the report
    ' with the RDC (don't forget to name the
    ' unmated fields the same as the selected
    ' area if them use the crBMTName param)
    '---------------------------------------------
    Report.AutoSetUnboundFieldSource crBMTName
    
    '---------------------------------------------
    ' code below generates by RDC
    '---------------------------------------------
    CRViewer1.ReportSource = Message
    CRViewer1.ViewReport
    Screen.MousePointer = vbDefault
End Sub then developed a crystal get located on ttx. from VB I am passing via ADS recordset data to crysatl report in the after way (TheĀ ...

Red Flag These Posting

Gratify let us know here why all post exists inappropriate. Related such because off-topic, duplicates, flames, illegal, vulgar, or students release their homework.

Red Flag Submitted

Gratitude you with helping keep Tek-Tips Forums free from inappropriate positions.
The Tek-Tips staff will check this output and take appropriate action.

Reply Up This Thread

Book in that Tek-Tips forums shall a member-only item.

Click Here to join Tek-Tips and talk with misc members! Already a Member? Sign