Results 1 to 3 of 3
  1. #1
    aaron.irvine is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Oct 2013
    Posts
    9

    Filtering by date in a report?

    Sorry guys, my brain is fried. I've done a heap of googling on it, but I'm not really sure where to start in all honesty.

    I've created a Form where I enter all my data - then I created a Report to output this data, it includes two buttons to filter based on one category. That's working fantastically well for me.

    But now I would like to filter on dates. For example, last 7 days, last 14 days etc - and also give the user the option of filtering between x and y dates. I've discovered this is easily done by right-clicking the date field in the report, but I'd prefer to embed these commands into buttons etc so it's easier to navigate.

    I'm sure it's a pretty straight forward task, but my lack of knowledge combined with my attempt to multi-task is killing my brain

    If anyone could point me in the right direction I'd be greatly appreciative.

    Thanks



    Aaron

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,960
    If you want to allow dynamic configuration of filter criteria, options are parameterized query as the report RecordSource or use VBA to build filter string and pass filter string to report when it is opened.

    For VBA approach, review: http://allenbrowne.com/ser-62code.html
    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
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows XP Access 2003
    Join Date
    Aug 2013
    Posts
    7,862
    I have not created worked with reports in this way. Only newer versions of Access allow for controls to be added to reports. However, it should not be much different than controls on a form.

    If I were to do this in a form I would create an option group and place some radio buttons in it. I would also place a couple of test boxes in an option group. With that the user can choose a radio button or enter values in the text boxes. The user can filter the report with an click event of a toggle button.

    The code in the click event would turn on or off the forms filter. The different radio buttons would represent a value in days and the text boxes could represent the user input of a date range.

    The code would create a where clause that would pass to the form's filter.

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

Similar Threads

  1. Date Filtering
    By Amerlitong in forum Forms
    Replies: 6
    Last Post: 02-05-2013, 11:27 PM
  2. Date Filtering within a Formula
    By JeanZander in forum Access
    Replies: 8
    Last Post: 10-17-2012, 07:00 PM
  3. Filtering forms by date
    By rwest in forum Forms
    Replies: 1
    Last Post: 01-03-2012, 11:23 AM
  4. Date Filtering problem
    By TubbyGrey in forum Access
    Replies: 6
    Last Post: 10-22-2010, 10:46 PM
  5. Replies: 13
    Last Post: 09-27-2010, 03:10 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