Subject |
dBase 2019 & Crystal Reports-A Solution |
From |
Louis James <l.james@lcsnet.net> |
Date |
Wed, 11 Jun 2025 16:43:14 -0400 |
Newsgroups |
dbase.getting-started |
Hoping this helps!
Have written several programs (apps) across the years, I have invested quite a lot in using Crystal Reports. I'm dating myself but back in dBase III days and Visual dBase, Crystal was the way to go.
Unfortunately, the Crystal VBX no longer works and learning the new reports in dBase 2019 was just not doable considering the massive number of reports needed to be converted.
There are several "Report Viewers" out there and most are relatively the same. I'm not here to convince you on any one report viewer (though I do have a favorite!)
The purpose of this post is to share with you my solution of being able to use both dBase 2019 and a "Crystal Report Viewer of your choice" and how to embed that viewer into your programming. The solution is amazingly simple.
The assumption is you are using dbf files (yes I realize there are other ways but again, programming from years ago is not easy to convert)
1.- When you create a dbf file to be used in Crystal make sure you use the TYPE DBMEMO3 in the creation. Do all your work in the regular dbf file with the MDX and the DBT but convert that to the "older" version using the TYPE DBMEMO3 For Example:
Copy NewDbaseFile.dbf To Report.DBF TYPE DBMEMO3.
NOTE: You will lose your MDX (or NDX) files as well as the DBT but that's ok because Crystal will do the sorting for you. (Unless you have some weird sorting. Then sort your file before you do the COPY.
WHY: Because Windows ODBC driver does NOT understand the new DBF files - at least in the 32-bit ODBC. (I have not found a 64-Bit ODBC for DBF files?)
2.- Create a 32-Bit ODBC Data Source using the "Driver do Microsoft dBase (*.dbf) driver. There are others and they may work but this one has been faithful. Change the configuration to point to the Directory where your Crystal files will pull from.
NOTE: Technically, you don't have to create the ODBC connection but it really makes it a lot easier in Crystal to manage the files.
NOTE: You can use either System or User DSN. I prefer System.
3.- Open Crystal Reports - I use Crystal Reports 2016 - because it sees the ODBC driver I used in step 2.
4.- Open your Crystal Report BUT DON'T TRY TO RUN IT or you will cry. First, fix your connectivity:
a.- Go to Database / Set Database Location (Current Data Source)
b.- Click on each file in the report and then go down to Replace with and click on the ODBC connection you created (Make sure the dbf file is in there)
c.- Click on Update. (this may take a while)
d.- Do that for all your files in the Crystal Report
5.- Click on Database / Verify Database. Unless you made drastic change, it should tell you it's up to date.
6.- Now test out the report
7.- If it works, save it (Save AS and give it a new file name and allow it to update to the new version of Crystal)
8.- Almost Last Step: In your dBase Application, make the following change:
Add the statement:
RUN(True,'"C:\Program Files (x86)\Path of the Report Reader\Report Reader Name.exe" "Crystal Report Name.rpt"')
NOTE: Pretty much does not matter with report reader you use. Just make sure you get the path to the EXE
NOTE: Be sure to use the "True" statement at the beginning because it hides the DOS (Command) window. The user never sees it.
NOTE: Be sure your filename and path are correct for the RPT.
NOTE: I don't worry about parameters because in the app I build, the user does all the parameters needed and then I build the output file.
9.- Test and retest.
I can direct you to consider a reader of you'd like but again, that's not the purpose of this post. I would assume there are many of you that have so many Crystal Reports and converting to the reports in dBase 2019 is painful. This may be a huge help. Hope so.
Don't know if I should cross-post this. Let's see how it goes.
All of you have helped me so much. I hope this is a small contribution to helping you and other. Have a great day.
Louis
|
|