• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 346
  • Last Modified:

Crystal Reports

I need to open up a file and read the content in crystal reports. Is it possible? Can I perform COM objects from Crystal Reports? Or shell a vbscript everytime the report is ran?
0
HackLife
Asked:
HackLife
  • 2
  • 2
1 Solution
 
WesleySaysHiCommented:
Create frmNAME (where NAME is a name you want to give to the Form), open it in Project mode then double click the Crystal Reports control from the Visual Basic Toolbar. The Control is now added to the Form and it will be invisible during runtime. The default name of the Control is CrystalReport1, you can leave it like that. In the Click event of the Report button you ad to the Form, write the following code:
Private Sub cmdReport_Click()
Dim V_INCH, H_INCH As Long
H_INCH=1440/Screen.TwipsPerPixelX ' these conversions help you to set the window where the file will be printed, using inch
V_INCH=1440/Screen.TwipsPerPixelY ' instead of twips
CrystalReport1.Destination=0 ' value 0 indicates that the file will be printed on the screen
CrystalReport1.ReportFilename="C:\Directory\Filename" ' write the Directory where the file is placed and the name of the File
CrystalReport1.WindowTitle="Any title you choose"
CrystalReport1.WindowTop=1*V_INCH     ' window will be placed at 1 inch from top of screen, you can choose another value
CrystalReport1.WindowLeft=1*V_INCH     ' window will be placed at 1 inch from left of screen, you can choose another value
CrystalReport1.WindowHeight=3*V_INCH     ' window will be 3 inch high, you can choose another value
CrystalReport1.WindowWidth=6*V_INCH     ' window will be 6 inch width, you can choose another value
CrystalReport1.Action=1 ' value 1 indicates that printing must start
End Sub

When you run the program and click on the "Report" button, the specified File will be printed on the screen in the window as defined.

Good luck,
Wesley
0
 
HackLifeAuthor Commented:
I don't have a visual basic tool bar.  I use crystal reports v.10. Anything else?
0
 
WesleySaysHiCommented:
If you read the users manual that came with crystal Report v.10, you should know that Crystal Reports v.10 includes powerful .NET, Java and COM report processing components that can be easily embedded into your applications. You have a range of viewers to choose from and without additional coding you can let end users drill down into reports, sort/filter information, refresh and print reports, and export them into many formats including PDF, Excel, and Word.
I could only guess what you need from your short question, therefore my previous answer was just a waste of time. There are still some issues, like: what kind of file would you like to open? But maybe this is not important and someone smarter than me can help you out!

Regards,
Wesley
0
 
HackLifeAuthor Commented:
Sorry, my company gave me the CD and license but no manual. How do I install these components or embed them as you say? This will make my life easier because I can then run code from the back.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now