Results 1 to 4 of 4
  1. #1
    wanderanwills is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Mar 2015
    Posts
    7

    Filter all dates within current month

    Hello I am new to the forum, and self learning Access.


    I am probably quite wrong but I am trying to apply a filter that returns all dates within the current month

    The bulk of the filter is from Microsoft Access examples.

    Private Sub MonthB_Click()
    DoCmd.ApplyFilter , "DueDate Year([DueDate]) = Year(Now()) And Month([DueDate]) = Month(Now())"
    End Sub

    It is not working??
    Any help would be greatly appreciated.


    Regards
    Stephen

  2. #2
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 7 32bit Access 2003
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,544
    Have checked that the code is actually being fired
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  3. #3
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,742
    I don't know your tables and fields, but it looks like there is an extra space in this
    Code:
    DueDate Year
    As with most posts, it would be helpful if we understood your database and what you are trying to accomplish.

    It is not working?? is not very helpful. As Bob asked --Do you know for sure that the code you highlighted is actually being executed? Do you get error message(s)?

    Also, Now includes time. I think you should change and use Date() instead of Now().

  4. #4
    wanderanwills is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Mar 2015
    Posts
    7
    Hi Everyone,

    Solved.
    "DueDate Year([DueDate]) = Year(Now()) And Month([DueDate]) = Month(Now())"
    Removed the 'DueDate' at the front.

    Thankyou for replying.

    Regards
    Stephen

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

Similar Threads

  1. Replies: 2
    Last Post: 02-12-2015, 05:14 AM
  2. Get first day and month of current year
    By Ruegen in forum Programming
    Replies: 3
    Last Post: 12-01-2014, 06:45 PM
  3. Replies: 6
    Last Post: 05-05-2014, 10:51 PM
  4. Current Month/Year Query
    By Roadbeer in forum Queries
    Replies: 3
    Last Post: 06-17-2013, 01:20 PM
  5. Showing dates in current month only
    By fistja in forum Queries
    Replies: 2
    Last Post: 04-09-2012, 10:17 AM

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