Cut and paste the following and look at it. This works
fine for me using a report request form and then accessing
the parameters on the request form in the "Open" event on
the report. I know this example does not have dates, but
they should work the same way. All you do is apply a
filter to the report itself where the filter is basically
a "WHERE" clause. I intend to have a date range for an
invoice report I am doing soon and I expect this method to
work just fine.
good luck.
_____________________________________________
Private Sub Report_Open(Cancel As Integer)
On Error GoTo Err_OpenReport
Me.Filter = ""
If Forms![CostReportRequest]![SelectionCriteria] = 1 Then
DoCmd.ApplyFilter , "User_Id = Forms!
[CostReportRequest]![UserCombo]"
ElseIf Forms![CostReportRequest]![SelectionCriteria] = 2
Then
DoCmd.ApplyFilter , "Vendor_Id = Forms!
[CostReportRequest]![VendorCombo]"
ElseIf Forms![CostReportRequest]![SelectionCriteria] = 3
Then
DoCmd.ApplyFilter , "Vendor_Id = Forms!
[CostReportRequest]![VendorCombo] AND Service_Id = Forms!
[CostReportRequest]![VendServCombo]"
ElseIf Forms![CostReportRequest]![SelectionCriteria] = 4
Then
DoCmd.ApplyFilter , "Department_Id = Forms!
[CostReportRequest]![DeptCombo]"
ElseIf Forms![CostReportRequest]![SelectionCriteria] = 5
Then
DoCmd.ApplyFilter , "Cost_Center_Id = Forms!
[CostReportRequest]![CostCntrCombo]"
ElseIf Forms![CostReportRequest]![SelectionCriteria] = 6
Then
Me.Filter = ""
ElseIf Forms![CostReportRequest]![SelectionCriteria] = 7
Then
DoCmd.ApplyFilter , "Vendor_Id = Forms!
[CostReportRequest]![VendorCombo] AND ServiceType = Forms!
[CostReportRequest]![SrvTypCombo]"
ElseIf Forms![CostReportRequest]![SelectionCriteria] = 8
Then
DoCmd.ApplyFilter , "Parent_Name = Forms!
[CostReportRequest]![ParentCombo]"
ElseIf Forms![CostReportRequest]![SelectionCriteria] = 9
Then
DoCmd.ApplyFilter , "Vendor_Id = Forms!
[CostReportRequest]![VendorCombo] AND Parent_Name = Forms!
[CostReportRequest]![ParentCombo]"
ElseIf Forms![CostReportRequest]![SelectionCriteria] = 10
Then
DoCmd.ApplyFilter , "Vendor_Id = Forms!
[CostReportRequest]![VendorCombo] AND Parent_Name = Forms!
[CostReportRequest]![ParentCombo] AND ServiceType = Forms!
[CostReportRequest]![SrvTypCombo]"
ElseIf Forms![CostReportRequest]![SelectionCriteria] = 11
Then
DoCmd.ApplyFilter , "Vendor_Id = Forms!
[CostReportRequest]![VendorCombo] AND Cost_Center_Id =
Forms![CostReportRequest]![CostCntrCombo]AND
InvoiceGroupNbr = Forms![CostReportRequest]![InvGrpCombo]"
ElseIf Forms![CostReportRequest]![SelectionCriteria] = 12
Then
DoCmd.ApplyFilter , "Vendor_Id = Forms!
[CostReportRequest]![VendorCombo] AND InvoiceGroupNbr =
Forms![CostReportRequest]![InvGrpCombo]"
End If
Err_OpenReport:
Me.Filter = ""
Exit Sub
-----Original Message-----
Hi all, I have been looking through the help files, and I
cant find the correct answer...
I'm trying to run monthly reports that allow a user to
select a month and find all the PO's invoiced in that
month...
For instance, In my table with PO's, I ahve a
date_invoiced field -- if this field is blank, I assume we
have not billed the account -- if there is a date, It
obviously has been billed.
I want to run a query/report when the user clicks the
report icon on the switchboard for this report it asks for
what beginning date? (user would enter 5-1-04) and end
date? (User would enter 5-31-04) and it would pull all the
po's that are invoiced from 5/1 - 5/30 of this year.
Sounds simple but its really killing me.. I cant figure
out how to have users have input in the query, and use
that to run a report...