Problem with printing report

Skip Bisconer

Who Me?
Local time
Today, 14:24
Joined
Jan 22, 2008
Messages
285
This code allows the user to select any or all of the reports by clicking on a check box on a form and clicking the Command0 button to print. Every report prints out except the Production report down near the bottom of the code. The error says I don’t have a report by the name listed. The report runs fine from the Objects window. So I actually copy pasted the name in the quotes so I know there are no typos. Can anyone see where my problem is?


Private Sub Command0_Click()
' Print Selected Route Reports

'Route A Reports

If RouteA = True Then
DoCmd.OpenReport "reptDailyOrdersForRouteA", acViewNormal, "", "", acNormal
DoCmd.OpenReport "reptItineraryRouteA", acViewNormal, "", "", acNormal
DoCmd.OpenReport "reptLoadRequirementsA", acViewNormal, "", "", acNormal
'DoCmd.OpenReport "reptHandlerProductListbyRoute", acViewNormal, "", "", acNormal
End If

If RouteB = True Then
DoCmd.OpenReport "reptDailyOrdersForRouteB", acViewNormal, "", "", acNormal
DoCmd.OpenReport "reptItineraryRouteB", acViewNormal, "", "", acNormal
DoCmd.OpenReport "reptLoadRequirementsB", acViewNormal, "", "", acNormal
'DoCmd.OpenReport "reptHandlerProductListbyRoute", acViewNormal, "", "", acNormal
End If

If RouteC = True Then
DoCmd.OpenReport "reptDailyOrdersForRouteC", acViewNormal, "", "", acNormal
DoCmd.OpenReport "reptItineraryRouteC", acViewNormal, "", "", acNormal
DoCmd.OpenReport "reptLoadRequirementsC", acViewNormal, "", "", acNormal
'DoCmd.OpenReport "reptHandlerProductListbyRoute", acViewNormal, "", "", acNormal
End If

If RouteD = True Then
DoCmd.OpenReport "reptDailyOrdersForRouteD", acViewNormal, "", "", acNormal
DoCmd.OpenReport "reptItineraryRouteD", acViewNormal, "", "", acNormal
DoCmd.OpenReport "reptLoadRequirementsD", acViewNormal, "", "", acNormal
'DoCmd.OpenReport "reptHandlerProductListbyRoute", acViewNormal, "", "", acNormal
End If

If RouteE = True Then
DoCmd.OpenReport "reptDailyOrdersForRouteE", acViewNormal, "", "", acNormal
DoCmd.OpenReport "reptItineraryRouteE", acViewNormal, "", "", acNormal
DoCmd.OpenReport "reptLoadRequirementsE", acViewNormal, "", "", acNormal
'DoCmd.OpenReport "reptHandlerProductListbyRoute", acViewNormal, "", "", acNormal
End If

If RouteF = True Then
DoCmd.OpenReport "reptDailyOrdersForRouteF", acViewNormal, "", "", acNormal
DoCmd.OpenReport "reptItineraryRouteF", acViewNormal, "", "", acNormal
DoCmd.OpenReport "reptLoadRequirementsF", acViewNormal, "", "", acNormal

End If

If Production = True Then
DoCmd.OpenReport "reptProductionDeliveryRequirements", acViewNormal, "", "", acNormal
End If

If Handler = True Then
DoCmd.OpenReport "reptHandlerProductListbyRoute", acViewNormal
End If

Me.RouteA = False
Me.RouteB = False
Me.RouteC = False
Me.RouteD = False
Me.RouteE = False
Me.RouteF = False
Me.Production = False
Me.Handler = False


End Sub
 
Thans for responding

I know you think it is obvious but as I told you in my original post that that was what the error said it was. What I am saying is the name is not spelled wrong. I click on the report in the object screen and selected Rename copy pasted it in to the code and I still get the same error. I also typed it in looking at the object window as I typed. Something else is wrong here. Please keep thinking of other solutions. The report runs perfectly when I run it from the object window. It just doesn't work in VBA. All the other reports you see run perfectly from VBA.

Please keep thinking of other solutions.
 
Copy the name from the reports window and replace it in your VBA code. The report name is spelled wrong in your VBA code.

That's what you message says. VBA gets that error right.

Of course it reports when you open from the report window, you've selected it.
 
The problem still persisted after I copied the name from the report widow. It only resolved when I deleted the report and rebuilt it with the same name.
 
Use the Debugger to find what line to code stops on and post same.
 
Thanks for your help. I have moved on now to more critical issues. I just posted my results in case some one else has the same issue. I will again try and solve it if I have a future problem. Thanks again, this site is awsome.
 

Users who are viewing this thread

Back
Top Bottom