ActiveConnection prob 
Author Message
 ActiveConnection prob

Hi,

Can anybody shed some light on this strange problem?

I am running a report file stored as a rpt file.  The
database location of this is set to a ttx data-definition
file.  I am retrieving a live recordset, passing it to the
report and displaying the report in the report viewer.  
The data is being passed back from a component as an
adodb.recordset.

Now, this works fine if my project is compiled as one and
the dll passing the recordset is local.  If however, the
component is compiled as a remote server file and sits in
MTS on a server, when I try to view the report, I get a
Crystal Reports error saying 'FIle Not FOund'.

The data returned in both cases is absolutely identical.  
The only difference is the activeconnection property of
both recordsets, as one shows vb as the app, while the
other shows MTS.

If anybody can help with this, it would be greatly
appreciated.  I have pasted the code below.

Thanks,

Jay

'********************************************************

Dim Report As New CrystalReport1

 Dim crRep As Craxdrt.Report
 Dim crApp As New Craxdrt.Application
 Dim crTable As Craxdrt.DatabaseTable
 Dim crDB As Craxdrt.Database

Option Explicit

Private Sub Command1_Click()
Call CRViewer_Display
End Sub

Private Sub Form_Load()

Dim hresult As Long
Dim i As Integer
Dim ii As Integer
Dim x As Integer
Dim rs As ADODB.Recordset
Dim AbPos As Long
Dim rscopy As ADODB.Recordset

Dim RT As clsReportTest

On Error GoTo errorhandler

Set rs = New ADODB.Recordset

rs.CursorType = adOpenStatic
Set RT = CreateObject("report_test.clsreporttest")

Set rs = RT.Get_Records

Set RT = Nothing

Set crRep = crApp.OpenReport("d:\report_test\corp10.RPT",
1)

' Loop through the database tables referenced by the report
' (at the moment none of the reports use more than one
table)
' and point them to the recordset we are using

crRep.Database.SetDataSource rs, 3, 1

For Each crTable In crRep.Database.Tables

   crTable.SetDataSource rs, 3

Next crTable

Call CRViewer_Display

Exit Sub

Screen.MousePointer = 0

errorhandler:
      MsgBox "Error Number " & Err.Number & " " &
Err.Description + " line number " + Erl, vbExclamation

End Sub

Public Sub CRViewer_Display()

' Finally, display the report!
CRViewer1.ReportSource = crRep

CRViewer1.ViewReport

End Sub



Fri, 30 Apr 2004 19:59:03 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Difference between .ActiveConnection and SET .ActiveConnection?

2. prob w var user defined type as class mem ( prob easy for an exp VB OO)

3. ADOX (ActiveConnection Property)

4. Setting the ActiveConnection property of a Command Object (ADO 2.7)

5. Set ADODB.Command.ActiveConnection = Conn

6. Problems setting ActiveConnection in ADODB.Command

7. How to use ActiveConnection on VB

8. ActiveConnection

9. what is wrong ? I want set rec.activeconnection

10. i want set rec.activeconnection to connection from com+

11. Problems setting ActiveConnection in ADODB.Command

12. Err 3001 on ActiveConnection

 

 
Powered by phpBB® Forum Software