Mr. Babu,
I want to run a crystal report from VB 6.0. What all references should I make. If possible, send me a sample code for testing.
Regards,
SatishHi,
I'm not Babu. But hope I can help you.
To call crystal report in your vb application, first you have to make reference to the following library files.
Crystal Report ActiveX Runtime Library
Crystal Report Viewer Control 9
Then you have to create objects in the folg. way.
Dim Appl As New CRAXDRT.Application
Dim Report As New CRAXDRT.Report
'Write this code where you want to invoke the report
----------------------
Set Report = Appl.OpenReport("report path")
Report.DiscardSavedData
'If report have parameter fields
Report.ParameterFields(1).AddCurrentValue variable1
Report.ParameterFields(2).AddCurrentValue variable2
CRViewer1.ReportSource = Report
CRViewer1.ViewReport
----------------------
Hope this will work!
Babu,
if you find any error, pls just let us know.|||Originally posted by harmonycitra
Hi,
I'm not Babu. But hope I can help you.
To call crystal report in your vb application, first you have to make reference to the following library files.
Crystal Report ActiveX Runtime Library
Crystal Report Viewer Control 9
Then you have to create objects in the folg. way.
Dim Appl As New CRAXDRT.Application
Dim Report As New CRAXDRT.Report
'Write this code where you want to invoke the report
----------------------
Set Report = Appl.OpenReport("report path")
Report.DiscardSavedData
'If report have parameter fields
Report.ParameterFields(1).AddCurrentValue variable1
Report.ParameterFields(2).AddCurrentValue variable2
CRViewer1.ReportSource = Report
CRViewer1.ViewReport
----------------------
Hope this will work!
Babu,
if you find any error, pls just let us know.
Hi harmonycitra,
Thank you for helping others.
We have to inform that the report (.rpt) file create from Crystal report IDE, Then we can open the report file from OpenReport() method.
Set Report = Appl.OpenReport(app.path & "\myreport.rpt")
yours friendly,
K.Babu|||hi
i m sabina..
i have same querry than i just post this.
i m using vb 6,CR 9 and M.Access..
i just write down this code and pass parameter in form .
but it give error "Parameter Field value is not in range"
plz..help me urgent..i m on deadline of project...
Thanx in Adavance
God Bless u,
Regards,
Sabina Maniar
U.A.E|||what id the value you passed to parameter?|||Hi,
I encounterd the following error msg
"Expected end of statement" at this line char 9
"Dim App As New CRAXDRT.Application"
Can anybody help me?|||Hi,
I am using VB6.0 , Access 2000,abd CR 8.0.
I am using the following code.
'Add reference to Crystal Reports x.x ActiveX Designer RunTime Library
'Add component Crystal Reports Viewer Control
'Add reference to Microsoft ActiveX Data Objects 2.8 Library
'oCnn = current open ADO connection object
Private Sub Command1_Click()
Dim oApp As CRAXDRT.Application
Dim oReport As CRAXDRT.Report
Dim oRs As ADODB.Recordset
Dim sSQL As String
sSQL = "SELECT * FROM Table1"
Set oRs = New ADODB.Recordset
Set oRs = oCnn.Execute(sSQL)
Set oApp = New CRAXDRT.Application
Set oReport = oApp.OpenReport(App.Path & "\MyReport.rpt", 1)
(1) oReport.Database.SetDataSource oRs, 3, 1
crvMyCRViewer.ReportSource = oReport
crvMyCRViewer.ViewReport
End Sub
I am getting an error report on line marked (1) that " Subscript beyond Range". I assume that this is due to declaration of oRs as Recordsat and the value required in place of oRs in the same line is "data".
I am not able to find a solution.
Can anyone please tell me how to proceed ?
Thank You,
GeoNav
Showing posts with label sample. Show all posts
Showing posts with label sample. Show all posts
Monday, March 12, 2012
Monday, February 20, 2012
Online SQL reference
Does anyone know of a quick online SQL reference or a dictionary of terms and sample strings?A co-worker just introduced me to a good, lightweight SQL site that sounds like what you want. Check out http://sqlzoo.net/howto/source/s.pl.htm and please let me know what you think.
-PatP|||you didn't know about sqlzoo before?
it's got a really nice interactive feature -- you can test your sql in multiple different database systems
great for learning the different sql dialects
there are links to all the different SQL Reference manuals on the home page -- http://sqlzoo.net/|||for additional SQL references, see my SQL Links (http://r937.com/sqllinks.cfm) page
(note to self: man, i gotta check those links and update that page, it's been almost a year, and i have a whole bunch of new ones to add!!)|||you didn't know about sqlzoo before?http://sqlzoo.net/I'm a hard core geek, and I lead a rather sheltered life... What can i say?
-PatP|||Thanks, Pat. That's basically what I was looking for.
I can't seem to find any info. on the query I'm trying...
This is in Access and what I want to do is go through my tables and only keep five records.
DELETE * FROM Table1 WHERE ... NOT IN
(SELECT TOP 5 * FROM Table1)
I realize that's wrong and the only way I can get it to work is to specify key fields from the table:
DELETE * FROM Table1 WHERE key_field NOT IN
(SELECT TOP 5 key_field FROM Table1
ORDER BY key_field)
The problem with that is the key_field is different for every table and I have about 500 tables I need to do this for. I need a more generic way to delete the records so I can reuse the query.
-PatP|||you didn't know about sqlzoo before?
it's got a really nice interactive feature -- you can test your sql in multiple different database systems
great for learning the different sql dialects
there are links to all the different SQL Reference manuals on the home page -- http://sqlzoo.net/|||for additional SQL references, see my SQL Links (http://r937.com/sqllinks.cfm) page
(note to self: man, i gotta check those links and update that page, it's been almost a year, and i have a whole bunch of new ones to add!!)|||you didn't know about sqlzoo before?http://sqlzoo.net/I'm a hard core geek, and I lead a rather sheltered life... What can i say?
-PatP|||Thanks, Pat. That's basically what I was looking for.
I can't seem to find any info. on the query I'm trying...
This is in Access and what I want to do is go through my tables and only keep five records.
DELETE * FROM Table1 WHERE ... NOT IN
(SELECT TOP 5 * FROM Table1)
I realize that's wrong and the only way I can get it to work is to specify key fields from the table:
DELETE * FROM Table1 WHERE key_field NOT IN
(SELECT TOP 5 key_field FROM Table1
ORDER BY key_field)
The problem with that is the key_field is different for every table and I have about 500 tables I need to do this for. I need a more generic way to delete the records so I can reuse the query.
Subscribe to:
Posts (Atom)