Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

REPORT PRINT in VB

Status
Not open for further replies.

VinayPatel

Programmer
Oct 13, 2000
12
BE
Can you please guide me,
What is the best utility to print reports in Visual Basic?
i.e. Data Reports, Crystal Reports or any other utility
[sig]<p>Patel Vinay<br><a href=mailto:bro_sys@hotmail.com>bro_sys@hotmail.com</a><br>[/sig]
 
Data reports is easier to maintain, change, and distribute. Crystal reports is more powerful (more built in functions, etc) Crystal reports is also much more difficult to distribute as the documentation doesn't always spell out which supporting files to include. [sig][/sig]
 
thanks mr rgordley
I will be using data report acc to your advice.
can you guide me how to use it ?

1 If i dont want to use dataenvironment from Designers
and write to code, can you give me small code, steps
datareport1.datamember = &quot;Select * from Stock&quot;
datareport1.datasource = cnnDatabase
datareport1.setfocus
What to put in report designer
are this steps correct ?

2 I am not able to use images from database

3 Can i use printform method or printer object

Your advice will really help me.


Patel Vinay
bro_sys@hotmail.com
 
I'm not really sure what you are asking under #1 but here is a method.

Design the report. (report1)

Use a sql query to open a recordset (rs) containing the information you wish on the report using either ADO or DAO

Set report1.DataSource = Rs
report1.Show


2. I am not sure whether it is possible to use images on a datareport.

3. The datareport carries its own printer button for printing the report.

Of course for optimum control you may wish to write your report completely in code. One way is to put a picturebox on a form and print to it. You can then put your own controls on the form to control printing, etc.

The VB help files contain a lot of information. You might start with &quot;Writing Reports with the Microsoft Data Report Designer.&quot;
 
rgordley,

How do you print the report to a PictureBox? I've never heard about this functionality.

Steve
 
Steve,

See Patel's answer for microsoft's documentation on this feature, but roughly:

assume you have a form (frmReport) with a large picturebox (picture1) on it, then:


Set objPrint = frmReport.Picture1

Then print to it just like you would if it were a printer.

objPrint.FontName = &quot;Times New Roman&quot;
objPrint.FontSize = 8
objPrint.Print Tab(80);
objPrint.Print Format(Now, &quot;mm/dd/yyyy&quot;)
objPrint.Print

etc
 
rgordley,

thanks for your reply
but hot to print on a specific row and col
to design report using Picture Box



Patel Vinay
bro_sys@hotmail.com
 
We use Active Reports because the designer is built into VB and so is the completed report. Users can not change them (no client program to mess with).
 
Patel,

You sure do ask a lot of questions :). If you have never formatted a report to a printer object before this will take a lot of experimentation. But roughly:

do until rs.eof
objprint.print rs!field1;
objprint,print tab(tabvalue1);
objprint.print rs!field2;
objprint.print tab(tabvalue2);
objprint.print rs!field3
loop

The above loop would print 3 fields (columns) for each row in the recordset.

when using a picturebox as a report you have to build your on paging routine (count the lines as you output them), your own print to hard copy routine, etc. It's a lot of work, but the you are in complete control.

Rich
 
Our Company has developed a software for Educational Inst. We have used Active Reports for Reporting. Now we decided to have our own reporting tool which enables end user to create, modify and delete reports. We are using Visual Basic and MSAccess as front and backend for our software. Please help me how to find a solution.
Thanks in advance.
Devdas
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top