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.
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.