I need to do reporting in VB6. Can I use Crystal Reports ? My program doesn't get its data from a database. I need to pass simple variables to the report rather than link it to a database. Please enlighten me.
Thanks and regards
Preethi

Recommended Answers

All 11 Replies

Yes surely u can use crystal reports. What is the Database u r using? Is it MS-Access or SQL Server or other. If u r stuck up at any point just post the code at which u r stuck up with. will try to do the needful.
Also can u tell me the version of crystal reports u r using.

Regards
Shaik Akthar

Hi aktharshaik,
Thanks, I do not want to link a database to the Report. I want to pass variables directly to it.

I need to do reporting in VB6. Can I use Crystal Reports ? My program doesn't get its data from a database. I need to pass simple variables to the report rather than link it to a database. Please enlighten me.
Thanks and regards
Preethi

use visual studio 2008

I think u can get some clue from this following thread, please have a look at it and if solves ur need, please post the reputation of the solution to the poster hell_tej.

http://www.daniweb.com/forums/thread140360.html

Let me know if there is something else than this is what u need along with the Backend and Crystal Reports Version u r using.


Regards
Shaik Akthar

I will go through the thread you have suggested. I am using crystal reports 9
Regards
Preethi

Hi,
The thread is not helpful. I am not particular about using crystal reports. Is there any reporting tool which would allow me to pass variables to the report directly without using a database. Migration to another platform is difficult at this point of time. (Have used C++ Builder in the past and was able to achieve the same using the built in QuickReport Tool)
Thanks and regards
Preethi

passing variable values is also possible in crystal report. But type of value you want to pass explain using example means what you want to pass report title or what ?

Hi Guest11,

Thanks for your reply,

okay, let me explain. The application collects data through the ports and displays it on the screen. These are typically Label Controls whose caption displays the values. We also have certain information entered at the start into text boxes and whose character or numerical values are stored away in appropriate variables. At a point in time the application freezes the screen and we have the option of generating the report. The Headings and other static text on the report is to be set at design time. The values from variables that the text boxes have stored away and that of the label controls displaying on screen have to be passed to the report and the report is to be previewed and printed. Here a database is an overkill and unnecessary overhead as we do not need any of the info to be archived etc.
Therefore if we could pass the variables directly to the reporting tool it would be better.

regards
Preethi

try this code
first of all make fields in your crystal report by using this steps
1. Open ur Crystal Report using crystal report wizard
2. select insert menu
3. select Field Object from Insert menu
4. Field Explorer window will open
5. In Field Explorer window right click Formula Fields then select New
6. Give to ur field say for example "aaaa"
7. Then Formula Editor window will open close that window
8. Popup window ask for saving changes click yes
9. Then from Field Explorer window double click ur field "aaaa"
10. take mouse out from that window and click in ur crystal report where u want to place ur variable value
11. then through vb coding if u hace button for displaying report then write this code ont button click event ..........
Add Crystal Report Control and Crystal Report Viewer Control form components and add control on ur form

CrystalReport1.Formulas(1) = "aaaa=' " & urVariableValue & "'"
CrystalReport1.ReportFileName=yourCrystalReportPath & yourCrystalReportFileName 
CrystalReport1.DiscardSavedData = True
CrystalReport1.Action = 1
CrystalReport1.WindowState = crptMaximized

Hi Guest11,

Thanks very much for your detailed explanation. It works!!!

I had to make some changes in the syntax as probably the Crystal reports version that I am using is different from yours.

I am now able to get the Report by passing variables directly of type String, Integer etc.

I am new to this forum. How should I close this Thread. I need to attribute the solution to you.

Thanks again,

Best Regards
Preethi

if your problem is solved than mark it as solved.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.