P
petite39
Guest
I have a report and on that report is a subreport.
The report record source is a query that references field DocID but is not on the report ...it's on the subreport, and the filter is created from the code below from mfilter.....
the subreport record source query references both the DocID and the InspectNum fields and has both fields on the subreport to print.
In my code I create a filter to only print certain records of the report.
Here's the code behind the print button on the form.....
Dim stDocName As String
Dim mfilter As String
Dim ctl As Control
Dim varItm As Variant, intI As Integer
stDocName = "rptDeficiencies"
For Each varItm In ctl.ItemsSelected
mfilter = "DocID = '" & Me.DeficiencyRpt.Column(0, varItm) & "'" & " and InspectNum = " & Me.DeficiencyRpt.Column(1, varItm)
DoCmd.OpenReport stDocName, acPreview, , mfilter
Next varItm
Here's my problem. When I run this code with the mfilter equaling only DocID , everythign works great...which by the way is a text field that's why there's quotes in the code.
When I add the InspectNum which is a long integer....I get a pop up box that says "Enter Parameter Value" InspectNum
Do I need the mfilter on the subreport or on the report? And if so, how do I get it to the subreport thru code? Or do I need to reference the subreport in the mfilter clause?
Any help would be greatly appreciated since I'm stumped.
The report record source is a query that references field DocID but is not on the report ...it's on the subreport, and the filter is created from the code below from mfilter.....
the subreport record source query references both the DocID and the InspectNum fields and has both fields on the subreport to print.
In my code I create a filter to only print certain records of the report.
Here's the code behind the print button on the form.....
Dim stDocName As String
Dim mfilter As String
Dim ctl As Control
Dim varItm As Variant, intI As Integer
stDocName = "rptDeficiencies"
For Each varItm In ctl.ItemsSelected
mfilter = "DocID = '" & Me.DeficiencyRpt.Column(0, varItm) & "'" & " and InspectNum = " & Me.DeficiencyRpt.Column(1, varItm)
DoCmd.OpenReport stDocName, acPreview, , mfilter
Next varItm
Here's my problem. When I run this code with the mfilter equaling only DocID , everythign works great...which by the way is a text field that's why there's quotes in the code.
When I add the InspectNum which is a long integer....I get a pop up box that says "Enter Parameter Value" InspectNum
Do I need the mfilter on the subreport or on the report? And if so, how do I get it to the subreport thru code? Or do I need to reference the subreport in the mfilter clause?
Any help would be greatly appreciated since I'm stumped.