codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  Report Printing - With Visual Basic in Access - Help  TMateer at 19:02 on Tuesday, September 19, 2006
 

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









CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums
//








Recent Forum Threads
•  Job @ EarlySail
•  Job @ EarlySail (perl)
•  Security - Code verify
•  IPC problem
•  Re: import contacts of msn/yahoo
•  Cookies and Threads C++
•  right justify a background in a table?
•  Help with Loop (C++/MFC)
•  Help with Loop (C++/MFC)


Recent Articles
ASP GetTempName
Decode and Encode UTF-8
ASP GetFile
ASP FolderExists
ASP FileExists
ASP OpenTextFile
ASP FilesystemObject
ASP CreateFolder
ASP CreateTextFile
Javascript Get Selected Text


© Copyright codetoad.com 2001-2007