|
I have set a button up on a form so the user can print out reports for distribution. Depending on the branch it will print different reports out. Some time a report will have no information on it and I want it to not print but then continue on to the next report.
I have added an error handler but it still prints the blank reports and all they say is error on the report.
I have also tried setting the property for No Data on each report but when I do that when it comes to a report that would be blank it doesn't continue on with the other reports.
Here is my code -- Could someone make a suggestion on how to do this?
Thanks
Tonia
>Private Sub print_service_divsion_packet_Click()
>On Error GoTo Err_print_service_divsion_packet_Click
>
>Rem SERVICE REPORTS
>
> Dim num As Integer
>
> num = 0
>
>While (num < [Number of Reports Wanted])
>
>Dim stDocName As String
>
>Rem Division Reports
>
> stDocName = "Graphs DIV"
> DoCmd.OpenReport stDocName, acNormal
>
> stDocName = "RPT Division - Service - YTD 875000"
> DoCmd.OpenReport stDocName, acNormal
>
> stDocName = "RPT Division - Service - Month 875000"
> DoCmd.OpenReport stDocName, acNormal
>
> stDocName = "RPT Division - Service - YTD 875100"
> DoCmd.OpenReport stDocName, acNormal
>
> stDocName = "RPT Division - Service - Month 875100"
> DoCmd.OpenReport stDocName, acNormal
>
>Rem Branch Reports
>
>Rem Des Moines
>
> stDocName = "Graphs D"
> DoCmd.OpenReport stDocName, acNormal
>
> stDocName = "RPT Branch - Service- YTD 875000 D"
> DoCmd.OpenReport stDocName, acNormal
>
> stDocName = "RPT Branch - Service- Month Summary 875000 D"
> DoCmd.OpenReport stDocName, acNormal
>
> stDocName = "Rpt Des Moines Tech - Service - YTD 875000"
> DoCmd.OpenReport stDocName, acNormal
>
> stDocName = "Rpt Des Moines Tech - Service - Month Summary 875000"
> DoCmd.OpenReport stDocName, acNormal
>
> stDocName = "RPT Branch - Service- YTD 875100 D"
> DoCmd.OpenReport stDocName, acNormal
>
> stDocName = "RPT Branch - Service- Month Summary 875100 D"
> DoCmd.OpenReport stDocName, acNormal
>
>Rem Des Moines Electrical
>
> stDocName = "RPT Branch - Service- YTD 875000 DE"
> DoCmd.OpenReport stDocName, acNormal
>
> stDocName = "RPT Branch - Service- Month Summary 875000 DE"
> DoCmd.OpenReport stDocName, acNormal
>
> stDocName = "RPT Branch - Service- YTD 875100 DE"
> DoCmd.OpenReport stDocName, acNormal
>
> stDocName = "RPT Branch - Service- Month Summary 875100 DE"
> DoCmd.OpenReport stDocName, acNormal
>
>Rem Kansas City
>
> stDocName = "Graphs K"
> DoCmd.OpenReport stDocName, acNormal
>
> stDocName = "RPT Branch - Service- YTD 875000 K"
> DoCmd.OpenReport stDocName, acNormal
>
> stDocName = "RPT Branch - Service- Month Summary 875000 K"
> DoCmd.OpenReport stDocName, acNormal
>
> stDocName = "RPT Branch - Service- YTD 875100 K"
> DoCmd.OpenReport stDocName, acNormal
>
> stDocName = "RPT Branch - Service- Month Summary 875100 K"
> DoCmd.OpenReport stDocName, acNormal
>
>Rem Kansas City Electrical
>
> stDocName = "RPT Branch - Service- YTD 875000 KE"
> DoCmd.OpenReport stDocName, acNormal
>
> stDocName = "RPT Branch - Service- Month Summary 875000 KE"
> DoCmd.OpenReport stDocName, acNormal
>
> stDocName = "RPT Branch - Service- YTD 875100 KE"
> DoCmd.OpenReport stDocName, acNormal
>
> stDocName = "RPT Branch - Service- Month Summary 875100 KE"
> DoCmd.OpenReport stDocName, acNormal
>
>Rem Omaha
>
> stDocName = "Graphs O"
> DoCmd.OpenReport stDocName, acNormal
>
> stDocName = "RPT Branch - Service- YTD 875000 O"
> DoCmd.OpenReport stDocName, acNormal
>
> stDocName = "RPT Branch - Service- Month Summary 875000 O"
> DoCmd.OpenReport stDocName, acNormal
>
> stDocName = "RPT Branch - Service- YTD 875100 O"
> DoCmd.OpenReport stDocName, acNormal
>
> stDocName = "RPT Branch - Service- Month Summary 875100 O"
> DoCmd.OpenReport stDocName, acNormal
>
>Rem Wichita
>
> stDocName = "Graphs W"
> DoCmd.OpenReport stDocName, acNormal
>
> stDocName = "RPT Branch - Service- YTD 875000 W"
> DoCmd.OpenReport stDocName, acNormal
>
> stDocName = "RPT Branch - Service- Month Summary 875000 W"
> DoCmd.OpenReport stDocName, acNormal
>
> stDocName = "RPT Branch - Service- YTD 875100 W"
> DoCmd.OpenReport stDocName, acNormal
>
> stDocName = "RPT Branch - Service- Month Summary 875100 W"
> DoCmd.OpenReport stDocName, acNormal
>
> Let num = num + 1
>
>Wend
>
>Exit_print_service_divsion_packet_Click:
> Exit Sub
>
>Err_print_service_divsion_packet_Click:
> Select Case Err.Number
> Case 2501
> Resume Next
> Case Else
> MsgBox Err.Description
> Resume Exit_print_service_divsion_packet_Click
> End Select
>
>End Sub
<Added>
I have set a button up on a form so the user can print out reports for distribution. Depending on the branch it will print different reports out. Some time a report will have no information on it and I want it to not print but then continue on to the next report.
I have added an error handler but it still prints the blank reports and all they say is error on the report.
I have also tried setting the property for No Data on each report but when I do that when it comes to a report that would be blank it doesn't continue on with the other reports.
Here is my code -- Could someone make a suggestion on how to do this?
Thanks
Tonia
>Private Sub print_service_divsion_packet_Click()
>On Error GoTo Err_print_service_divsion_packet_Click
>
>Rem SERVICE REPORTS
>
> Dim num As Integer
>
> num = 0
>
>While (num < [Number of Reports Wanted])
>
>Dim stDocName As String
>
>Rem Division Reports
>
> stDocName = "Graphs DIV"
> DoCmd.OpenReport stDocName, acNormal
>
> stDocName = "RPT Division - Service - YTD 875000"
> DoCmd.OpenReport stDocName, acNormal
>
>Rem Branch Reports
>
>Rem Des Moines
>
> stDocName = "Graphs D"
> DoCmd.OpenReport stDocName, acNormal
>
> stDocName = "RPT Branch - Service- YTD 875000 D"
> DoCmd.OpenReport stDocName, acNormal
>
>Rem Kansas City
>
> stDocName = "Graphs K"
> DoCmd.OpenReport stDocName, acNormal
>
> stDocName = "RPT Branch - Service- YTD 875000 K"
> DoCmd.OpenReport stDocName, acNormal
>
> Let num = num + 1
>
>Wend
>
>Exit_print_service_divsion_packet_Click:
> Exit Sub
>
>Err_print_service_divsion_packet_Click:
> Select Case Err.Number
> Case 2501
> Resume Next
> Case Else
> MsgBox Err.Description
> Resume Exit_print_service_divsion_packet_Click
> End Select
>
>End Sub
|
|
|
|
|
|
|
// |