Results 1 to 6 of 6
  1. #1
    Rainbows5. is offline Novice
    Windows 10 Office 365
    Join Date
    May 2025
    Posts
    5

    results for the currect month only

    hi ,



    i have a query that gives me all the data for all records that are closed . how can i get it that it only gives me the data for the current month what do i put into the criteria
    thank you

    steve

  2. #2
    Join Date
    Apr 2017
    Posts
    1,792
    Code:
    ... WHERE ... AND Year(YourDate) = YEAR(Date) AND Month(YourDate) = Month(Date)

  3. #3
    Rainbows5. is offline Novice
    Windows 10 Office 365
    Join Date
    May 2025
    Posts
    5
    thanks .i am no good at putting code in .is iot possible to tell me what to type in the criteria .on the feild called "dateclosed" thanks steve

  4. #4
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,550
    You substitute YourDate with DateClosed
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  5. #5
    Micron is offline Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,421
    It might depend on what you want when you run it on January 3rd for example. Would you be looking for records from December, or will it always be the current month of the current year? Also, I think those answers are exactly what your post asked for. By that I mean Closed will not be pertinent to what you're looking for. Try putting this in your year field in query design grid
    Year(YourDateFieldNameHerer) = YEAR(Date) AND Month(YourDateFieldNameHere) = Month(Date)
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  6. #6
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,550
    In the field row you want Year(YourDateFieldNameHere)
    In the Criteria row you want
    YEAR(Date)

    Repeat in another column for the rest in the same way.
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

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

Similar Threads

  1. Replies: 1
    Last Post: 06-27-2024, 03:17 PM
  2. Replies: 6
    Last Post: 08-21-2019, 07:17 AM
  3. Replies: 5
    Last Post: 10-08-2014, 02:23 PM
  4. Replies: 5
    Last Post: 06-17-2014, 12:11 AM
  5. Replies: 5
    Last Post: 05-24-2012, 02:34 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