Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Learning VB5 and Crystal Reports 8 1

Status
Not open for further replies.

Beaner5434

Programmer
Jul 18, 2001
12
US
I have been working with Access for a few years, and I can make that app dance if I need to. But now I am expanding my resources, and I am trying to figure out how to get Visual Basic 5 and Crystal Reports 8 to talk with one another. Specifically, I am wanting to learn how to use VB5 to pass filters and sorts to pre-designed CR8 reports, using both flat reports and, in some cases, subreports. I have a very good understanding of VB5, and I have worked a little with the CR ocx packaged with VB. But Crystal is baffling me, and I am hoping that someone out there can recommend some good resources/examples that I can dissect to get a handle on developing effective reports for the VB apps I develop. So if you have any suggestions, PLEASE!!

Thanks!
 
There seems to be a general "ban" on Crystal documentation on the web. There is a hidden link somewhere on the official website which has really nice samples of Crystal in VB, but I can't find it anymore. But it's not that hard to learn really, especially if you worked with Access before.
 
R u referring to CR4 which is shipped with VB6...If then u can have the following lines added to ur code after designing ur report in crystal reports desinger....

krarpt.SelectionFormula = &quot;<conditions>&quot; 'krarpt is the CR control name
krarpt.ReportFileName = App.Path + &quot;\ctan.rpt&quot; 'path and file name of the report to show
krarpt.DataFiles(0) = &quot;calldb.mdb&quot; 'database file name and path
krarpt.PrintReport 'print .....

U need to have the crystal report component checked in ur project...and have the control in the form where u'll write the above code...

Ok now u need to tell me how will u make access dance..!!!
 
check the crrdc.hlp file that came with cr8.x

also here is some code for sending parameters
Code:
Option Explicit
Dim varCRAXDRT_App2 As New CRAXDRT.Application
Dim varCRAXDRT_Rpt2 As New CRAXDRT.Report

private sub test()
 Set varCRAXDRT_Rpt2 = varCRAXDRT_App2.OpenReport(varReportFileName) 'put path to file in var (i.e. varReportFileName = &quot;\\rmd\vol1\groups\wwc\crystaltest\reports\txt.rpt&quot;) (the report is on a server)
        varCRAXDRT_Rpt2.Database.Tables.item(1).SetLogOnInfo &quot;yoda&quot;, &quot;&quot;, varSYSTEM_USERID, varPASSWORD 'this is an oracle db and login
        varCRAXDRT_Rpt2.ParameterFields(1).AddCurrentValue varLocGIN 'this is the parameter in the report. they start with 1 rather than 0
        varCRAXDRT_Rpt2.PrinterSetup frmSelectReport.hWnd 'allows printer selection by the user
        frmCrystalViewer.Zoom (2)
        frmCrystalViewer.ReportSource = varCRAXDRT_Rpt2
        frmCrystalViewer.ViewReport
        Set varCRAXDRT_Rpt2 = Nothing

end sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top