Crystal Reports 8.5 Queries

rpk2006
10-14-2004, 09:23 AM
Following is my code I am using to print my report (using Crystal Report 8.5).


Private Sub Print3()
Dim CPR As CrystalReport1

Set CPR = New CrystalReport1

VehCount = 0

PrintCont:
With CPR
.txtPermitNo.SetText VehicleArray(VehCount, 50)

'Printed related numbers if number of vehicles more than 1
If NV > 1 Then
.txtRelated.SetText StartPermitNo & "-" & EndPermitNo
End If

.txtPermitHolder.SetText VehicleArray(VehCount, 2)
.txtVisitDate.SetText ProgramDate
.txtVehicleNo.SetText VehicleArray(VehCount, 3)
.txtRoute.SetText VehicleArray(VehCount, 15)
.txtRouteGuide.SetText VehicleArray(VehCount, 16)
.txtpV12.SetText VehicleArray(VehCount, 6) & "/" & VehicleArray(VehCount, 7) & "/" & VehicleArray(VehCount, 8)
.txtpC12.SetText VehicleArray(VehCount, 9) & "/" & VehicleArray(VehCount, 10) & "/" & VehicleArray(VehCount, 11)
.txtpC5.SetText VehicleArray(VehCount, 12) & "/" & VehicleArray(VehCount, 13) & "/" & VehicleArray(VehCount, 14)
.txtpVID.SetText VehicleArray(VehCount, 5)
.txtpCamS.SetText VehicleArray(VehCount, 17)
.txtpCamV.SetText VehicleArray(VehCount, 18)
.txtpFilmFee.SetText VehicleArray(VehCount, 17)

If VehicleArray(VehCount, 55) <> "" Then
.txtpFilmingDesc.SetText VehicleArray(VehCount, 55)
End If

If VehicleArray(VehCount, 56) <> "" Then
.txtpFilmingDesc.SetText VehicleArray(VehCount, 56)
End If

.txtpEntFee.SetText VehicleArray(VehCount, 51)
.txtpVehFee.SetText VehicleArray(VehCount, 52)
.txtpCamFee.SetText VehicleArray(VehCount, 53)
.txtpFilmFee.SetText VehicleArray(VehCount, 54)

If VehCount = NV - 1 Then
.txtpTotFee.SetText TotFee
End If

.PrintOut
End With


I want that as the counter starts for printing, the print status should also be checked for whether the print was successful or not. If the print fails, the control should automatically resume with that VehCount.

Secondly, the report which I prepared using Crystal Report is just of one page with no Data/Parameter fields. As you can see from the above code, I am simply transferring values of variables into Text Boxes on the Report.
The problem with above code is that the printing starts with VB 6 Warning, "Please insert paper", and the printing stops after every page. I want it to print till the loop finishes.

Thirdly, when I press the above Command Button, Crystal Report displays a dialog box asking the number of pages to print. I want to suppress it.

Help me.

MKoslof
10-15-2004, 05:57 PM
You can suppress the print dialog by passing in the parameter you need, such as number of copies:



MyReport.printout false, 1



If you want to monitor the print job, you are going to have use some Windows API calls to manage the printer object. There are no native Crystal Report methods that will do this for you :)

rpk2006
10-17-2004, 11:46 PM
The code I gave above prints only one page and stops. I want that as the loop continues and new values are retrieved from VehicleArray, Crystal Report should continue printing till the condition of loop is satisfied.

MKoslof
10-18-2004, 04:53 AM
Then remove the "1" parameter from the declaration, if you leave the "PrintOut False" code piece, the user will not be prompted for a printer, it will just print to the default printer..and it will print over and over again within the loop.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum