Click to See Complete Forum and Search --> : *SOLVED*displaying crystal report within the mainform
myrrdan
Apr 6th, 2004, 10:40 AM
I'm new to crystal reports, so please keep the burns to a minimum lol.
Anyways, i was wondering if its possible to display a crystal report within a form, rather than have it popup the form itself.
This way they keep all the controls etc from the form, and can view the report, (with scrolling capabilities to move around the form)
I'm modeling the program after a pre-existing program they had created around 92.
They want to keep it as close to the original as possible so they don't have to learn anything new lol. They're busy enuf that they don't really have time for that.
Now if it is possible, what components/references are needed?
I want to try to figure it out myself, but in order to do that, i'ld like to at least know if its possible & where i should set my feet to start.
Thanks.
ARPRINCE
Apr 6th, 2004, 08:23 PM
Yes, have the form as a child of the Main form. Components and references depends upon the CR version you have. If you are using CR9, then you need:
- Crystal Report 9 ActiveX Designer Runtime Library (Reference)
- Crystal Report Viewer Control 9 (component)
You can also try Crystal's website for other samples on how to integrate your VB with CR.
myrrdan
Apr 7th, 2004, 09:32 AM
hmm ok, i'll have to check it out.
Thanks for the suggestions.
:D
myrrdan
Apr 7th, 2004, 10:23 AM
ok, seagates site is a pain..
i wasn't able to find anything on embedding reports in visual basic.
do i run the reports like i would a word document??
i have no idea how to link the crystalviewer object to an actual file.
there is no reportpath or anything.
reportsource, but after set to the filepath of the report, it still comes empty. 0 records.
ARPRINCE
Apr 7th, 2004, 10:24 AM
What your...CR Version? VB Version?
myrrdan
Apr 7th, 2004, 10:25 AM
lol, sry my brain just isnt' with it this morning.
vb 6, cr 8
ARPRINCE
Apr 7th, 2004, 10:37 AM
CR8 uses a different approach (dll/ocx/ttx,etc.) on how to render reports on a form from CR9 so I may not be a lot of help to you.
This (http://support.businessobjects.com/communityCS/FilesAndUpdates/cr8_vb_api_activedata.exe.asp) could probably get you started.
You can try using the advance search (http://support.businessobjects.com/search/advsearch.asp?q=) from CR.
Hope this helps.
myrrdan
Apr 7th, 2004, 11:24 AM
Thanks for the links. I downloaded the ex. but it hasn't helped in the slightest way lol.
I'll just have to see if theres something else i can get to work. I have no idea how to link my crystalviewer to the report file.
Nothing i do seems to work.
Thanks though.
myrrdan
Apr 7th, 2004, 12:58 PM
Ok, i'm at a loss. I can't get this to work no matter what i do, and its frustrating me.....
This is the only code i have been ablet o put in that bloody works without crashing vb.
Now i'm uinsg cr 8, vb 6.
I have
Crystal Report Viewer Conrol component inserted.
Crystal report viewer control(vb6 one)
Crystal report viewer control(cr 8 one)
crystal report 8 activex designer runtime library.
references.
Public Report1 As New CRAXDRT.Report 'CrystalReport1
frmMain.crvEnroll.ReportSource = Report1
so how am i supposed to even set this stupid thing?
the crvEnroll is the crystalviewer.
I have to tell it to open the file
app.path & "\files\EnrolledHorse.rpt"
I can't find anything on this. Everythign i've found is either creating the bloody report, or opening & printing it outside of VB.
Can anyone give me any information at all?
brucevde
Apr 7th, 2004, 04:12 PM
Crystal has to basic options to show reports within a VB application.
One, everything is embedded with the VB project. You cannot modify the report outside your project. Change your report and you must recompile the EXE.
Two. Create your reports outside of your VB project. Use Crystal's automation server to manipulate the report. Much like manipulating MS Office products from VB.
I only work with option two. Here are the basics.
Your project should reference the component Crystal Report Viewer Control (crviewer.dll) and the Crystal Report 8 ActiveX Designer Runtime Library.
Add a CRViewer control to your Form.
'its best to declare the following objCrystalReport variable globally and
'Create the instance when the application starts
Dim objCrystalApp as CRAXDRT.Application
Set objCrystalApp = New CRAXDRT.Application
Public Sub ShowReport(ByVal PathToReport as String )
Dim objReport as CRAXDRT.Report
Set objReport = objCrystalApp.OpenReport(PathToReport)
frmMain.crvEnroll.ReportSource = objReport
frmMain.crvEnroll.ViewReport
Set objReport = Nothing
End Sub
'do this when your application shutsdown.
Set objCrystalApp = Nothing
Depending on your database and how you created your report you may need to set the Login Information. I will add a link to a thread I posted many moons ago. It may give you some ideas.
Also, there are separate Help files for "developers". These are not accessible from within the Crystal product. There should be a sub-folder under Crystal installation location called ..\Developer Files.
myrrdan
Apr 7th, 2004, 04:25 PM
well Bruce, got 1 thing to say..
THANK YOU!!!!!!!!!!!!
lol
i owe you pal, like you wouldn't belive.
I've been struggling with this since 8:40 this morning, its now 3:25!
i was missing this from what i had tried....
Dim objCrystalApp As CRAXDRT.Application
Set objCrystalApp = New CRAXDRT.Application
Dim objReport As CRAXDRT.Report
Set objReport = objCrystalApp.OpenReport(strPath)
thank you thank you thank you!
brucevde
Apr 7th, 2004, 04:39 PM
I just have one thing to say to you
Go Canucks!!!!!!!!!!!!
Oh and your welcome.
myrrdan
Apr 7th, 2004, 04:41 PM
ROFL!!!
Canucks fan huh..just when i thought you were normal ! lol
j/k
Flames Rules! (well not really, i dont' watch hockey, lol, but can't agree with everything)
:wave:
saran_12345
Aug 22nd, 2006, 05:36 AM
OK friends, can anybody help me with my CR - XI and VB6......Please
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.