Why doesn't Access quiery work for the year 2021?

kidsvavo 1 Reputation point
2021-02-05T18:07:19.883+00:00

I have an access query that I need to pull all the records for a certain month and year. It works fine for all years that are on the list of records except it will not query for the year 2021. Why?

Access Development
Access Development
Access: A family of Microsoft relational database management systems designed for ease of use.Development: The process of researching, productizing, and refining new or existing technologies.
893 questions
{count} votes

9 answers

Sort by: Most helpful
  1. kidsvavo 1 Reputation point
    2021-02-11T12:37:59.357+00:00

    Above is the SQL using the Eligibility Date field (a calculated field in a table) Just in case this type of field was causing the problem in some way, I changed the query to not use that field and created a field in the query to give me the same eligibility date and tried using it that way. Same thing. Works for years prior to 2021 but not 2021. I'm so perplexed. Here is that SQL.

    SELECT [Employees].[Company ID], [Employees].ID, [Employees].[Last Name], [Employees].[First Name], [Employees].DOH, DateSerial(Year([DOH]),Month([DOH]),Day([DOH])+90) AS [Eligibility Date], [Employees].Age, Month([Eligibility Date]) AS [Month], DatePart("yyyy",[Eligibility Date]) AS [Year]
    FROM [Employees]
    WHERE (((Month([Eligibility Date]))=Month(Now())) AND ((DatePart("yyyy",[Eligibility Date]))=[Enter Year]) AND (([Employees].[Employee Status - Current])="A"));


  2. kidsvavo 1 Reputation point
    2021-02-12T14:17:34.323+00:00

    I really appreciate at all the attempts to help! It is just a table. Not linked.
    I tried renaming it to ThisYear and it makes no difference. I am a novice as far as actual programming code goes however, I have been using Access for 12 years successfully and have never had this type of issue. I tried to run the debugger as suggested and only saw a grey screen. I saw nothing happening. Not sure what that means.


  3. kidsvavo 1 Reputation point
    2021-02-18T14:13:07.907+00:00

    I've already tried that. It has nothing to do with the name. In looking for help online, I have written this multiple ways, and each way works perfectly with all years prior to 2021. I even tried to make the eligibility date to 2022 to see if that works and it does not. No year beyond 2020 works. ALL years prior to 2020 work. This is unbelievably perplexing.

    0 comments No comments

  4. kidsvavo 1 Reputation point
    2021-02-19T17:27:03.637+00:00

    To all that tried to help, thank you! I have finally resolved the issue. In my search for a solution, I found an answer to someone's old question in 2011 that was similar but different, yet the problem was the same.
    I had 2 eligibility date fields that were blank in the whole table. I don't know why this didn't effect years prior to 2021, but adding the dates resolved the issue.
    Again. thanks

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.