Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 345
  • Last Modified:

how to do continuous printing crystal report in vb

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
hemantn
Asked:
hemantn
  • 2
2 Solutions
 
mlmccCommented:
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
 
DRRYAN3Commented:
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
 
DRRYAN3Commented:
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now