I have a Customers form with a subform on it to show the order details for that Customer.
I would like for the user to be able to open a report from that form and view the results of that customer order.
I have a Report based on the same recordsource as the subform and a command button on the Customer form to open the Report.
If I open the Report NOT using the form command button, it shows the data fine. If I open it using the command button I get NO data.
Here is my code for the command button.The subform is linked by CustomerID
Attached is pics of Report and also query it is based on.Plus command button code.
On Error GoTo Err_Command55_Click
Dim strReportName As String
Dim strCriteria As String
strReportName = "CustomerOrders"
strCriteria = "[CustomerID]" = " & Me![CustomerID] & " '"
DoCmd.OpenReport strReportName, acViewPreview, , strCriteria
Exit_Command55_Click:
Exit Sub
Err_Command55_Click:
MsgBox Err.Description
Resume Exit_Command55_Click