CRAXDRT.Dll (CR XI Viewer)
For some reason there arent many CR XI resources available. As a matter of fact, Robdogg's code on the forums is about all I could find when it came to attaching data to the CRViwer. The only problem is it says my object is not defined, and it is talking about CRAXDRT being not referenced(I assume that is the crystal reports viewer control).
Main problem.
I have CR XI and I am using Crystal Reports Active X Viewing Control and i cant find any help on getting it to view a report through visual basic. The only code i could find came from robdogg and i got a referencing error. Maybe it is because I am missing a .dll *exp craxdrt.dll
I honestly dont know.
Here is the code i attempted to use:
VB Code:
Private Sub Form_Load()
Dim oApp As CRAXDRT.Application
Dim oReport As CRAXDRT.Report
Dim oRs As ADODB.Recordset
Dim sSQL As String
sSQL = "SELECT * FROM Permits"
Set oRs = New ADODB.Recordset
Set oRs = oCnn.Execute(sSQL)
Set oApp = New CRAXDRT.Application
Set oReport = oApp.OpenReport(App.Path & "\Surface.", 1)
oReport.Database.SetDataSource oRs, 3, 1
crvMyCRViewer.ReportSource = oReport
crvMyCRViewer.ViewReport
End Sub
If anyone has any good refernces or ideas they would be greatly appreciated.
Re: CRAXDRT.Dll (CR XI Viewer)
I downloaded older versions of the craxdrt.dll and crviewer.dll and it seems to be working now...
I get the error
"Object or with block variable not set"
on line:
VB Code:
Set rs = cn.Execute(sSQL)
Re: CRAXDRT.Dll (CR XI Viewer)
Have you set up oCnn/cn properly?
Re: CRAXDRT.Dll (CR XI Viewer)
I believe so....
here is the code, for the form...
VB Code:
Option Explicit
Dim rs As ADODB.Recordset
Dim cn As ADODB.Connection
Private Sub Form_Load()
Dim oApp As CRAXDRT.Application
Dim oReport As CRAXDRT.Report
Dim sSQL As String
sSQL = "SELECT * FROM Permits Where " & frmSearch.Combo1.Text & " Is Like " & frmSearch.txtsearch.Text
Set rs = New ADODB.Recordset
Set rs = cn.Execute(sSQL)
Set App = New CRAXDRT.Application
Set oReport = oApp.OpenReport(App.Path & "\Surface.", 1)
oReport.Database.SetDataSource rs, 3, 1
crvMyCRViewer.ReportSource = oReport
crvMyCRViewer.ViewReport
End Sub
Re: CRAXDRT.Dll (CR XI Viewer)
You have a Dim, but no Set.
Re: CRAXDRT.Dll (CR XI Viewer)
Quote:
Originally Posted by cid
I believe so....
here is the code, for the form...
VB Code:
Option Explicit
Dim rs As ADODB.Recordset
Dim cn As ADODB.Connection
Private Sub Form_Load()
Dim oApp As CRAXDRT.Application
Dim oReport As CRAXDRT.Report
Dim sSQL As String
sSQL = "SELECT * FROM Permits Where " & frmSearch.Combo1.Text & " Is Like " & frmSearch.txtsearch.Text
Set rs = New ADODB.Recordset
Set rs = cn.Execute(sSQL)
Set App = New CRAXDRT.Application
Set oReport = oApp.OpenReport(App.Path & "\Surface.", 1)
oReport.Database.SetDataSource rs, 3, 1
crvMyCRViewer.ReportSource = oReport
crvMyCRViewer.ViewReport
End Sub
VB Code:
Dim rs As ADODB.Recordset
Dim cn As ADODB.Connection
Set rs = New ADODB.Recordset
Set cn = New ADODB.Connection
Re: CRAXDRT.Dll (CR XI Viewer)
Ok thanks for the help so far...
Error:
Invalid TLV Record:
VB Code:
Option Explicit
Private Sub Form_Load()
Dim rs As ADODB.Recordset
Dim cn As ADODB.Connection
Set rs = New ADODB.Recordset
Set cn = New ADODB.Connection
cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & App.Path & "\TractPro.mdb; Persist Security Info=False"
Dim oApp As CRAXDRT.Application
Dim oReport As CRAXDRT.Report
Dim sSQL As String
sSQL = "SELECT * FROM Permits"
cn.Open
Set rs = cn.Execute(sSQL)
Set oApp = New CRAXDRT.Application
Set oReport = oApp.OpenReport(App.Path & "\Surface.rpt", 1)
oReport.Database.SetDataSource rs, 3, 1
crvMyCRViewer.ReportSource = oReport
crvMyCRViewer.ViewReport
End Sub
Anyone have any ideas... while you guys try and work this out with me, im going to google and find out what a TLV record is :D
Re: CRAXDRT.Dll (CR XI Viewer)
Alright, I figured out what the problem is... Since i dont have CR 9/10.0 installed I cant use the 10.0 CRViewer...
I have CR XI on this computer...
Does anyone have any ideas for transfering the code above for CR 10 to CR11..?
I would be using the Crystal Reports Active X Control packaged with CR11... I would have been using it this entire time but there is very little documentation on it.
Re: CRAXDRT.Dll (CR XI Viewer)
Re: CRAXDRT.Dll (CR XI Viewer)
Dear CID,
Have you got the solution?
if so, please guide me - i am aslo facing same problem with CR - XI.
Please Please Please