 |
| View previous topic :: View next topic |
| Author |
Message |
Avis Junior Poster

Joined: 07 Oct 2003 Posts: 510 Location: India
|
Posted: Nov 6th, 2003 02:44 AM Post subject: Crystal Reports 8.5 Tutorial |
|
|
Here's the step by step tutorial for making a simple Crystal Report and using it with your VB project.
* Open Crystal Reports 8.5
* Select 'As a Blank Report'
* Then you get Data Explorer
* Go for 'Database files' --> 'Find database files' and select database.
* Then select Table i.e. Profile and Click on Add button.
* Then it shows 'Field explorer' or you can select it from 'Insert Menu' --> 'Field Object'
* It shows 'Field Explorer'.
* Drag and drop what ever fields you want from Database fields on the Details section of the report.
* Close 'Field Explorer'.
* Then go for 'Report Menu' --> 'Edit Select Formula' --> 'Record'
* There you can select Name field from database fields and put conditon.
* It seems like this: {Profiles.Name}='somename'
* Save it and Close. (i.e. Record Select Formula)
* Refresh Report and check whether it is working fine?
* Then Save Crystal report. (I'm assuming its name is TestReport & Under C drive)
Calling Crystal Report from VB
Select Crystal Report Control from Components.
Select Crystal Report Engine from References.
Place Crystal Report Control on the From and write below code to call the crystal report.
| Code: | CrystalReport1.ReportFileName = "c:\TestReport.rpt"
CrystalReport1.Action = 1 |
Hope this helps you to create simple crystal report. _________________ Code Snippets, Tutorials, Utilities, Controls
Low cost Web Hosting
Hosting starts at as low as $4 per year!
Always follow posting guidelines
Put your VB code in [vb ] your code [ /vb] tags! |
|
| Back to top |
|
Avis Junior Poster

Joined: 07 Oct 2003 Posts: 510 Location: India
|
Posted: Nov 6th, 2003 02:47 AM Post subject: |
|
|
Hi!
Now in the above post we have inserted the value in the report itself.
* It seems like this: {Profiles.Name}='somename'
What if we want to do it through VB at runtime ? Try the following to set value's at runtime. Using paramters you can do it dynamically.
* Open your Crystal report.
* Insert Menu --> Field Object --> It shows Field Explore
* There you can create a parameter for eg. param_name (string).
* Open Selection Formula Editor.
* Select parameter in the place of hardcoded name.
* It seems like this: {Profiles.Name}={?param_name}
* Save selection formula and report.
Now the VB code:
| Code: | Dim strName
'strName is the Parameter value you can pass 'Bann' or 'smokey' or what ever you want
strName = "smokey"
CrystalReport1.ReportFileName = "c:\TestReport.rpt"
CrystalReport1.ParameterFields(0) = "param_name;" & strName & ";true"
CrystalReport1.Action = 1 |
Hope this works! _________________ Code Snippets, Tutorials, Utilities, Controls
Low cost Web Hosting
Hosting starts at as low as $4 per year!
Always follow posting guidelines
Put your VB code in [vb ] your code [ /vb] tags! |
|
| Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|