Results 1 to 15 of 15
  1. #1
    Nuke1096 is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Apr 2013
    Posts
    53

    Generating a Filtered Report by selecting a Month from Combo Box

    Hello all. Fairly new to Access, but been making good strides! However, I've hit a snag on how to do something I'd like to add to my current project. Basically what I would like to do is create a Combo Box with each month of the year available to select. When I click on a specific month, I want it to pop open a Report based on my table that is filtered by the month I selected. I have a Date column already created in my base table to be my filtering device.



    I've already learned how to use query's and reports a bit. I have a Command Button on my form that launches a report based on a query that only shows data for the current year. Likewise, I created one that only shows data for things with a specific item code using a [Which Item Code?] criteria in my query. So in theory, I could do this by creating 12 different buttons, 12 different query's, and 12 different reports. That seems like overkill though and it would seem there has to be an easier way to do that simply by using a combo box to select the month you want to filter.

    Any suggestions are much appreciated.

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,524
    Sounds like this may fit:

    http://www.baldyweb.com/wherecondition.htm
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Nuke1096 is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Apr 2013
    Posts
    53
    I'm a bit confused. Wouldn't I have to create a Report first and based if off a query somehow?

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,524
    Yes, I thought you already had that.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    Nuke1096 is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Apr 2013
    Posts
    53
    Unfortunately not. I'm not sure what I would need for the criteria to only select the specific month that is selected in the combo box, or how to connect the two together.

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,524
    I'm confused as to what you meant by this then: "I have a Command Button on my form that launches a report based on a query that only shows data for the current year." If you have that, and presuming one of the fields in the report is the date field you mentioned, if the combo contained the appropriate dates it could be used with the above technique to further restrict the report by month.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  7. #7
    Nuke1096 is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Apr 2013
    Posts
    53
    Right, but I would then need a different Report that is based off a different query using different criteria than the query that is generating the report for Current Year button.

    Am I right or wrong with that?

  8. #8
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,524
    Perhaps I don't understand the situation, but I see one report. I'd have a form for the user to select whatever criteria were needed to filter the report; year, month, code, etc. Then use the above technique or a parameter query to open the report. I'd only have multiple reports if the layout was different.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  9. #9
    Nuke1096 is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Apr 2013
    Posts
    53
    To get a better idea of what I mean, I attached the database.


    Nova.zip

  10. #10
    Nuke1096 is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Apr 2013
    Posts
    53
    I'm not sure if what I did is the most efficient way of doing things. Probably not, since I'm still learning, but basically, what I want is for the Combo Box to work the same way as the above three buttons do. Except I want it to filter by Month (instead of Year, Bus, etc), which would be selected from the list.

  11. #11
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,524
    At a glance, the 3 reports appear to have the same layout and source, just different criteria. If so, like I said I'd have a single report. I'd probably have 2 textboxes for a date range and just let the user enter the desired dates. You can have a combo or textbox for bus and if left blank they get all. You can do a similar thing with the dates to let them get all.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  12. #12
    Nuke1096 is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Apr 2013
    Posts
    53
    But I'm still confused as to how you would go about linking the values you set in the drop down box to a query. How would the query know I'm selecting "March" for example from the drop down combo box instead of "April"?

  13. #13
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,524
    I would use the textboxes previously mentioned for beginning and ending dates. If you wanted, you could use a combo that pushed dates to those textboxes. To use the combo alone you'd have a hidden column containing the month number 1-12 and use the Month() function on your date field to match. That to me is overly complicated so not the way I'd go.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  14. #14
    Nuke1096 is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Apr 2013
    Posts
    53
    I think I got it working now! Thanks for all the help and quick responses to all my questions

  15. #15
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,524
    Happy to help!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Printing A Filtered Report from a Combo Box
    By jaarons in forum Programming
    Replies: 4
    Last Post: 01-28-2013, 05:32 PM
  2. Replies: 3
    Last Post: 11-06-2012, 03:25 PM
  3. Replies: 5
    Last Post: 05-24-2012, 02:34 PM
  4. Replies: 9
    Last Post: 12-02-2011, 12:51 PM
  5. Reports filtered by Month
    By Douglasrac in forum Access
    Replies: 3
    Last Post: 01-27-2011, 05:01 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums