Connecting Tech Pros Worldwide Forums | Help | Site Map

Reports pulled by certain criteria

Member
 
Join Date: Aug 2007
Posts: 111
#1: Aug 27 '07
How do i go about setting up reports to run based on a filter? Say someone wants to run a report for a certain date - i need a way that the person can enter any given information and the report run based on that info. Is there a way to set up a form that has a text box (or whatever it may be) where they can enter their info and then click a button to run that report (filtered)?

BradHodge's Avatar
Expert
 
Join Date: Apr 2007
Location: Lubbock, Texas - U.S.A
Posts: 160
#2: Aug 27 '07

re: Reports pulled by certain criteria


Set up an unbound form that has combo boxes to get the criteria that you want to filter by. Then, on that form, create a button that will open the report by the link criteria that the user has specified in the combo boxes.

If you need additional assistance, please don't hesitate to ask.

Brad.
Member
 
Join Date: Aug 2007
Posts: 111
#3: Aug 27 '07

re: Reports pulled by certain criteria


Sorry i'm still new to Access. I panicked when i added a button and there was no option for "Open Report"...then i read your reply and realized i could use do.cmd OpenReport on the OnClick property.

Thanks!
BradHodge's Avatar
Expert
 
Join Date: Apr 2007
Location: Lubbock, Texas - U.S.A
Posts: 160
#4: Aug 27 '07

re: Reports pulled by certain criteria


You might try something like this in the code behind that button...

Expand|Select|Wrap|Line Numbers
  1. Dim stDocName As String
  2. Dim stLinkCriteria As String
  3.  
  4. stDocName = "rptMyReport"
  5. stLinkCriteria = "[TheDate]=" & Forms!MyNewForm!cboDATE
  6.  
  7. DoCmd.OpenReport stDocName, , , stLinkCriteria
This will open your report based the date that is entered in the combo box of the new form you created.

Let us know how it comes out.

Brad.
Reply