Results 1 to 6 of 6
  1. #1
    82280zx's Avatar
    82280zx is offline Advanced Beginner
    Windows 7 64bit Access 2013
    Join Date
    Jan 2014
    Posts
    82

    Need help setting up a filter again.

    I'm a bit tired so I hope I make sense. I made a report to show calls for the current month, the report shows the call type, the users that had those call types and it counts how many of those calls each user had.

    So example:
    Call Type 1
    Bob had 4


    Billy had 3

    I have the Report working... but I want to be able to make a form with two combobox's, one for year and one for month and filter my query so my report only shows a report for the Month and Year I selected via combo box's. I've done this with previous data but didn't have to work with dates yet.

    My Call Query or Call Table has a date field formatted as 00/00/0000 . Does that make sense?

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,956
    Calculate fields in query to extract the month and year. Apply filter criteria to those constructed fields.

    Year([date field])

    Month([date field])
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    82280zx's Avatar
    82280zx is offline Advanced Beginner
    Windows 7 64bit Access 2013
    Join Date
    Jan 2014
    Posts
    82
    Quote Originally Posted by June7 View Post
    Calculate fields in query to extract the month and year. Apply filter criteria to those constructed fields.

    Year([date field])

    Month([date field])
    Those filters worked but how do I filter my combo box's to only show 1 month or 1 year based on the data? Right now it's showing a Month and Year for each record.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,956
    Sorry, don't understand the question. Why should the combobox show only 1 year? It should list all years from the data. Limiting the month list to only those months that have data for each year is a cascading (dependent) combobox.

    RowSource for each combobox:

    SELECT DISTINCT Year([date field]) FROM tablename;

    SELECT DISTINCT Month([date field]) FROM tablename WHERE Year([date field])=[cbxYear];

    Will need code behind the year or month combobox to requery the month combobox.

    Sub cbxMonth_GotFocus()
    Me.cbxMonth.Requery
    End Sub

    Post the sql of the parameterized query if still have issue.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    82280zx's Avatar
    82280zx is offline Advanced Beginner
    Windows 7 64bit Access 2013
    Join Date
    Jan 2014
    Posts
    82
    No I wanted it to show all months all years, but the problem is it's showing January for each record, so when I drop the box down it shows January like 10 times in a row, same go's for the year. Does that make sense? I'll try what you listed here, thanks again for all your help June7.

  6. #6
    82280zx's Avatar
    82280zx is offline Advanced Beginner
    Windows 7 64bit Access 2013
    Join Date
    Jan 2014
    Posts
    82
    Sorry I forgot to close the post, your awesome btw June7! Wish I had the knowledge you have so I wouldn't have to bug ya so much. Thanks again!

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

Similar Threads

  1. Filter By Form and Apply Filter Buttons
    By JustLearning in forum Forms
    Replies: 13
    Last Post: 02-18-2015, 01:01 PM
  2. Replies: 1
    Last Post: 08-16-2012, 01:51 PM
  3. Apply Filter similar to Field Filter
    By DatabaseIntern in forum Forms
    Replies: 1
    Last Post: 06-11-2012, 05:42 PM
  4. Replies: 28
    Last Post: 03-08-2012, 06:47 PM
  5. How to filter dates using an apply filter code.
    By Jgreenfield in forum Reports
    Replies: 4
    Last Post: 11-15-2011, 01:38 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