Solved

Crystal Report from Data Control

Posted on 1998-12-03
4
232 Views
Last Modified: 2013-12-25
I have a data control recordset with a crystal report control bound to it.  When I action the report I only see the first 3 or 4 columns on the preview and I have no way of programatically altering the size and headings of the columns.  This recordset may very well contain records from other tables or data sources and the report will be used as a general "dump to printer" or "dump to file" option.  Any help from anyone would be most appreciated...
0
Comment
Question by:AlanMarsham
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 2

Expert Comment

by:cedricd
ID: 1488672
i will explain how i use the crystal report, maybe will you find the solution on it.
first i make a sql query linked to a data control.
in my sql query, i select all the field i need for my report (also in another table)

example : select a.*, b.* from tablea as a,tableb as b where ...

when my query is executed by the datacontrol, i print a crystal report into a file

code :

       Crystal.SQLQuery = sql
       Crystal.ReportSource = crptDataControl
       Crystal.PrintFileType = crptCrystal
       Crystal.PrintFileName = App.Path + "\Reports\" + Fichier
       Crystal.ReportFileName = App.Path + "\Reports\" + Fichier
       Crystal.Destination = crpttofile
       Crystal.PrintReport
After, i open the report created and i modify the layout (maybe where's too many field, you had to insert manually them choose insert menu database field and you can insert all the bound control field)
you can modify the properties of the crystal field (format,border etc..)

when it's done,print the crytal to the window (to verify if it's correct) and to the printer if it's good

       Crystal.SQLQuery = sql
       Crystal.ReportSource = crptReport
       Crystal.PrintFileType = crptCrystal
       Crystal.PrintFileName = App.Path + "\Reports\" + Fichier
       Crystal.ReportFileName = App.Path + "\Reports\" + Fichier
       Crystal.Destination = crptto(window or printer)
       Crystal.PrintReport

the sql command must be with same field but you can change the table name, the db name and their place.The fields must be the same (with the same order)

hope i help you.
                CD
0
 
LVL 2

Expert Comment

by:cedricd
ID: 1488673
Don't forget to link the datacontrol with crystal report control !
0
 

Author Comment

by:AlanMarsham
ID: 1488674
From my user's point of view this is too complicated - I don't mind how complicated it is to program but it has to be relatively user friendly to use.  Besides, my customers normally don't have a copy of Crystal Reports so they can't adjust the layout of the report.

Could really do with a "run report and fit to x pages wide" option which automatically picks all columns in the attached data source.
0
 
LVL 2

Accepted Solution

by:
cedricd earned 100 total points
ID: 1488675
if your customer had to modify the layout, he won't be able to do it without crystal report,with crystal report there's only two maniers to make a report : one use the crystal report program to make a report linked to a database, second with the code i past to you.
a report is always linked to a sql statement (select * from table or a more complicated sql statement).
The number of columns are defined by the sql statement or by you using crystal report.
When the number of select field change then you had to make a new report (maybe a solution is to select all the possible field into a temporaly table, adding a logical field which is true when you had to print the field and in crystal report for each field program a formule like if {bound control.logicfield} then {bound control.field1}
and to make yourself a layout.
the temporaly table can be an access table.
you can program the page header (new page after, before etc..)
it's all you can do with crytal for you problem.
Maybe if you explain more better the program you had to make,i will be able to propose you the best solution.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question