?
Solved

how to do continuous printing crystal report in vb

Posted on 2003-03-20
5
Medium Priority
?
335 Views
Last Modified: 2008-01-09
Hello experts
I M new to this Crystal reports
I need to take a printout of Customer's Slip on A4 size paper
Since the customer list is huge i need to take this slip in a huge quantity
 i hv made formating/Desingned the report to print the slip
From vb on click event
sql="select * from customerlist"
rs.open sql,con
do until rs.eof
CR1.Formulas(0) = "dnum ='" & rsRPT(0) & "'"
        CR1.Formulas(1) = "cDate='" & rsRPT(1) & "'"
        CR1.Formulas(2) = "cTime='" & rsRPT(2) & "'"
        CR1.Formulas(3) = "cName='" & rsRPT(3) & "'"
        CR1.Formulas(4) = "bldgnum='" & rsRPT(4) & "'"
        CR1.Formulas(5) = "nOfComplaint='" & rsRPT(5) & "'"
        CR1.Formulas(6) = "tManId='" & rsRPT(6) & "'"
        CR1.Formulas(7) = "mReqd='" & rsRPT(7) & "'"
'THE ABOVE FORMULAE IS USED IN REPORT TO PRINT THE VALUE
        CR1.SelectionFormula = " if {tb1.FIELD1} in [" & rsRPT.Fields("id") & "] then true else false "
'THE ABOVE CODE I PRINT DETAIL SECTION OF REPORT BECAUSE THERE ARE MANY VALUES 'TO BE PRINTED
        CR1.PrintReport
       
        rs.movenext
loop
So the values get previewd and we press the printer button and the report gets fires
How will the above report get fired in a continuous process, one after the another for each recordset per report page with the event fired once (without the preview window) to be printed.
0
Comment
Question by:hemantn
[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
  • 2
5 Comments
 
LVL 101

Accepted Solution

by:
mlmcc earned 400 total points
ID: 8174269
Here is what I would do

sql="select * from customerlist"
rs.open sql,con
do until rs.eof
CR1.Formulas(0) = "dnum ='" & rsRPT(0) & "'"
       CR1.Formulas(1) = "cDate='" & rsRPT(1) & "'"
       CR1.Formulas(2) = "cTime='" & rsRPT(2) & "'"
       CR1.Formulas(3) = "cName='" & rsRPT(3) & "'"
       CR1.Formulas(4) = "bldgnum='" & rsRPT(4) & "'"
       CR1.Formulas(5) = "nOfComplaint='" & rsRPT(5) & "'"
       CR1.Formulas(6) = "tManId='" & rsRPT(6) & "'"
       CR1.Formulas(7) = "mReqd='" & rsRPT(7) & "'"
'THE ABOVE FORMULAE IS USED IN REPORT TO PRINT THE VALUE
       CR1.SelectionFormula = " if {tb1.FIELD1} in [" & rsRPT.Fields("id") & "] then true else false "
'THE ABOVE CODE I PRINT DETAIL SECTION OF REPORT BECAUSE THERE ARE MANY VALUES 'TO BE PRINTED
       CR1.PrintReport
  CR1.Reset      
       rs.movenext
loop

mlmcc
0
 
LVL 12

Assisted Solution

by:DRRYAN3
DRRYAN3 earned 400 total points
ID: 8174368
Looks like you are using the OCX version.  A few suggestions:

1.  Never, Ever use SELECT * FROM ...  it is about 1000 times slower than naming all the fields individually.

2.  If you have defined your report to have the same table as its data source as your select statement in VB, then you are at least doubling the workload.  The fact that you're changing the CR.SelectionFormula to filter based on the passed ID code tells me that either you are passing too many parameters or you should base your report on a one record dummy table and just print the formula values.

3.  When you switch from the OCX version to the ActiveX viewer version, you should consider using the CRAXDRT objects (if you have verion 7.5 or higer).  These objects will allow you to print directly to the printer without a preview.  I seem to recall that you could do this with the OCX version as well but you had to use the print engine calls.  See http://support.crystaldecisions.com/library/kbase/articles/c2003324.asp for more details.

See http://support.crystaldecisions.com/library/kbase/articles/c2002365.asp for more details on the two main object models used in more current versions of CR.

DRRYAN3
0
 
LVL 12

Expert Comment

by:DRRYAN3
ID: 8174369
Looks like you are using the OCX version.  A few suggestions:

1.  Never, Ever use SELECT * FROM ...  it is about 1000 times slower than naming all the fields individually.

2.  If you have defined your report to have the same table as its data source as your select statement in VB, then you are at least doubling the workload.  The fact that you're changing the CR.SelectionFormula to filter based on the passed ID code tells me that either you are passing too many parameters or you should base your report on a one record dummy table and just print the formula values.

3.  When you switch from the OCX version to the ActiveX viewer version, you should consider using the CRAXDRT objects (if you have verion 7.5 or higer).  These objects will allow you to print directly to the printer without a preview.  I seem to recall that you could do this with the OCX version as well but you had to use the print engine calls.  See http://support.crystaldecisions.com/library/kbase/articles/c2003324.asp for more details.

See http://support.crystaldecisions.com/library/kbase/articles/c2002365.asp for more details on the two main object models used in more current versions of CR.

DRRYAN3
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses
Course of the Month14 days, 3 hours left to enroll

801 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